Modern Feature Of Angular2

Posted By : Anchal Gaur | 29-Sep-2017

Angular is asserted to be very fast and speedy by default without lapse. But is fastness depends on application component tree structure and the bindings which it introduces. There are following features which comes into existence that helps to improve the application.

 

Components-Based:- Entire Angular2 is component based. Scopes and contollers are no longer into existence because they have been dispaced by components and directives.

components are directive with template. There is a snapshot of code which tells how actually component is built.

 

Directives:- The detailing for directives is remarkably considered although they are still subject to replace. A directive can be declared with directive annotation. This is a limited set of  prospects. In the 'Host Listners'  blog  standard functions can be linked to their own implementations. Directives can also be used with own components including predefined and their own directives. For the sample 'NgFor' and  'Hover'  directive in a component cab be used and this will be imported initially.

 

Dependancy Injection:- By the improved dependancy injection model in angular2 there are more probability for component or object based work. The dependancy injection consists of three parts. Injectors which contains the API's to inject the dependencies and make the dependancy injection accessible. Bindings makes it acheiveable for dependencies to be named. But now for the final actual dependencies for the object are generated so that they can be injected.

At the stage in component an object is passed into the constructor and this only needs to be passed through the injector view . The objects are generally enclosed in square brackets and these object van be used to inject.

There is some extra annotations which have been added and augmented the possibilities for dependancy injectio, for example InjectPromise annotation . with this annotation 

asynchronicity can be acheived and object that have been created is only injected.At the same case optional value or library can be created with optional annotation.

A special application of dependancy injection is HTTP. With the use of HTTP injectables which exists into angular package, HTTP objects can be injected and on this object REST operations can be performed. For this example a public test server with REST response has been used.

About Author

Author Image
Anchal Gaur

Anchal has a good knowledge of HTML,CSS and Javascript. She is working here as a UI Developer. Her hobbies are travelling and to read novels in free time.

Request for Proposal

Name is required

Comment is required

Sending message..