Component in Angular 2
Component
The
component is a controller class segregating two aspects of data member and
member function; we relate data member as view and member function as
function/logic to Acton on data member. The component knows how to render
itself and configure dependency injection.
Syntax and Code Snippet
import { Component } from '@angular/core';
@Component({
selector: 'myapp',
template: `<h1>Hello {{name}}</h1>`
})
export class AppComponent { name = 'Angular2'; }
.html
body section
<body>
<myapp>Loading Please wait ...</myapp>
</body>
Common
Syntax
@Component
The@Component is
a decorator which uses configuration object to create the component and its
view
Component in Angular 2
Reviewed by Rupesh
on
04:03
Rating:
No comments: