Posts

Showing posts with the label Components

Angular 2.0 Components - Part 2

Image
Templates define a component's view or HTML content for the component.In template there are two type define template in-line template template URL command This is how it work Metadata Metadata defines the way to process a class. We can define the metadata by using decorator. The @Component decorator, which identifies the class immediately below it as a component class.If the “Component” is not defined, then Type Script  treats this as a simple class. Data binding Used to bind the data between view and business logic . In angular 2.0 there are four forms of data binding . As a summary of data binding. Directives Used to extend HTML attributes and provide some special behaviors to HTML DOM elements.A directive is a class with a @Directive decorator. There are two type of Directives structural directives : alter layout by adding, removing, and replacing elements in DOM Attribute directives : alter the appearance or behavior of an existing element....

Angular 2.0 Components

Image
Angular 2.0 Components Modules   designed for performed single task .Every angular app has at least one root module and more featured module.angular is a class which is decorated with @NgModule . NgModule is a decorator function that takes a single metadata object whose properties describe the module. Declarations : Describes the view class for the module.there are three kind of view class available Components  Directives  Pipes Imports - Define the modules that we want to import in our module. Providers - creators of services that this module contributes to the global collection of services; they become accessible in all parts of the app. Exports - Defines the name for the module, using which we can use this module. Bootstrap - It defines the main component to be Bootstrap in main.ts file. Components similar to a controller class with a template so components deal with view of the Application and the logic on the page.     ...