Components are the views of our Angular application in the sense that they control what, when, and how things should be displayed on the screen. They take the form of a simple class that defines the logic required by your views. Here's an example of a simple component:
export class FloydComponent implements OnInit { private floydString:string = ""; private static startOfAlphabet = 97; constructor() { } ngOnInit() { } onClick(rows:number){ let currentLetter = FloydComponent.startOfAlphabet; for (let i = 0; i < rows; i++) { for (let j = 0; j < i; j++) { this.floydString += String.fromCharCode(currentLetter) + " "; currentLetter++; } this.floydString += "\n\r"; } } }