< description

Notes, thoughts, failures. A blog.

< tags | sort -R | ಠ_ಠ
 
soyuka@soyuka.me ~/soyuka.me/tags/angular2/

Angular2 external subscriber in a directive (Output)

You made a great component that leverage reactive forms. The thing is, you want to share this directive, and let users define the Observable that should be used by the custom form component. The naive way to make this work would be to bind that Observable in an @Input, and then use that input in the component. We will see here why it doesn’t feel right and how to implement it as an @Output.


~900 Words

Angular2 providers, view providers and "singletons"

The following is an illustration of how providers act through the angular application, or the components tree. You can control their action scope by using providers or viewProviders so that multiple sibling components share the same instance of that provider.