Angular 2 – Metadata

Angular 2 – Metadata ”; Previous Next Metadata is used to decorate a class so that it can configure the expected behavior of the class. Following are the different parts for metadata. Annotations − These are decorators at the class level. This is an array and an example having both the @Component and @Routes decorator. Following is a sample code, which is present in the app.component.ts file. @Component ({ selector: ”my-app”, templateUrl: ”app/app.component.html” }) The component decorator is used to declare the class in the app.component.ts file as a component. Design:paramtypes − These are only used for the constructors and applied only to Typescript. propMetadata − This is the metadata which is applied to the properties of the class. Following is an example code. export class AppComponent { @Environment(‘test’) appTitle: string = ”Welcome”; } Here, the @Environment is the metadata applied to the property appTitle and the value given is ‘test’. Parameters − This is set by the decorators at the constructor level. Following is an example code. export class AppComponent { constructor(@Environment(‘test’ private appTitle:string) { } } In the above example, metadata is applied to the parameters of the constructor. Print Page Previous Next Advertisements ”;

Angular 2 – Home

Angular 2 Tutorial PDF Version Quick Guide Resources Job Search Discussion Angular 2 is an open source JavaScript framework to build web applications in HTML and JavaScript. This tutorial looks at the various aspects of Angular 2 framework which includes the basics of the framework, the setup of Angular and how to work with the various aspects of the framework. Other topics discussed in the tutorial are advanced chapters such as interfaces, nested components and services within Angular. Topics such as routing, modules, and arrays are also dealt with in this tutorial. Audience This tutorial is for those who are interested in learning the new version of the Angular framework. The first version of the framework has been there for quite some time and it is only off-late that Angular 2 has become popular with the web development community. Prerequisites The user should be familiar with the basics of web development and JavaScript. Since the Angular framework is built on the JavaScript framework, it becomes easier for the user to understand Angular if they know JavaScript. Print Page Previous Next Advertisements ”;