angularjs2 common stuff that i always forgets



Providers

@NgModule
{
   providers : []  // providers
}
providers array provide a dependency injection layer between ngmodule and other child components. A child component will typically traverse to the parent to look for a provider - a singleton service or in plain language a class with a tasks like news feed service or http service.

if you specify providers in a child component, this service will be instantiated as a separate instance.


BrowserModule 

This module provides services for running and opening browser. What type of services?
Always import BrowerModule in the root AppModule.ts.


@Input and @Output

Passing data using @Input  (Property passing with [] )  and @Output (event passing with ()  )

Custom Directive 

You essentially can still create custom directive in Angular2.

@Pipe 

@Pipe - custom, stateless and stateful pipe










Comments

Popular posts from this blog

ionic2 cordova build android - Unable resolve gradle 2.2.3

OpenCover code coverage for .Net Core

Using Custom DLL with IronPython / Scripts