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: 5

No comments:

All Rights Reserved by Technology from Developers Eye © 2014 - 2015
Powered By Blogger, Designed by Aadics
Disclaimers:: The information provided within this blogsite is for general informational purposes only. While we try to keep the information up-to-date and correct, there are no representations or warranties, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the information, products, services, or related graphics contained in this blogsite for any purpose.The author does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause.

Contact Form

Name

Email *

Message *

Powered by Blogger.