In angular2 we are using component to write Business logic of application and extends with (.ts). Each application consists of Components. Each component is a logical boundary of functionality for the application.
@Component ({
selector: 'my-app',
template: '<h1>hello</h1>'
})
Example:
app.Component.ts:
import { Component } from '@angular/core';
import { AppService } from './app.service';
@Component ({
selector: 'my-app',
templateUrl: 'app/app.component.html'
})
export class AppComponent {
appTitle: string = 'Welcome';
constructor(private appService : AppService){
} }