First off, let's import the component decorator:
import { Component } from '@angular/core';
Then create the class for your component:
class AppComponent {
title:string = 'hello app';
}
Then decorate your class using the Component decorator:
@Component({
selector: 'app',
template: `<h1>{{ title }}</h1>`
})
export class AppComponent {
title: string = 'hello app';
}
We give the Component decorator, which is function, an object literal as an input parameter. The object literal consists at this point of the selector and template keys, so let's explain what those are.