Inline template:
"<h1>{{ pageTitle }}</h1>"
Inline template:
template: `
{{ pageTitle }}
My First Component
</div> `
Linked Template:
templateUrl:
'product-list.component.html'
When binding should be used?
Interpolation:
{{pageTitle}}
Property Binding:
<img [src]='product.imageUrl'>
Event Binding:
<button (click)='toggleImage()'>
Two Way Binding:
<input [(ngModel)]="listFilter'/>
How to build a simple application:
import { Component } from 'angular2/core';
@Component({
selector: 'selector-name',
templateUrl: 'app/something-something.component.html'
})
export class ProductListComponent {
pageTitle: string = 'Hello World!';
}
No comments:
Post a Comment
If you have any doubts or questions, please let us know.