Gonzalo Chumillas
2016-06-25 18:48:09 UTC
I would like to make a component available for all other components and
inject it as a service. The following code won't work, since Angular 2
actually creates two instances of ModalPreloader:
// file: app_component.dart
@Component(
selector: 'app-component',
templateUrl: 'app_component.html',
styleUrls: const ['app_component.css'],
// a "Modal Preloader" is at the same time a "directive" and a "service"
directives: const [ModalPreloader],
providers: const [ModalPreloader])
AppComponent {}
// file: app_component.html
// html code...
// Modal Preloader component
<modal-preloader></modal-preloader>
Is it possible to inject an existing component as if it were a service?
This way, I could access that component from any sub-component.
Thanks.
inject it as a service. The following code won't work, since Angular 2
actually creates two instances of ModalPreloader:
// file: app_component.dart
@Component(
selector: 'app-component',
templateUrl: 'app_component.html',
styleUrls: const ['app_component.css'],
// a "Modal Preloader" is at the same time a "directive" and a "service"
directives: const [ModalPreloader],
providers: const [ModalPreloader])
AppComponent {}
// file: app_component.html
// html code...
// Modal Preloader component
<modal-preloader></modal-preloader>
Is it possible to inject an existing component as if it were a service?
This way, I could access that component from any sub-component.
Thanks.
--
You received this message because you are subscribed to the Google Groups "angular-dart" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular-dart+***@googlegroups.com.
Visit this group at https://groups.google.com/group/angular-dart.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular-dart/eca755ba-4bb1-4f41-83a2-fea530c34092%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "angular-dart" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular-dart+***@googlegroups.com.
Visit this group at https://groups.google.com/group/angular-dart.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular-dart/eca755ba-4bb1-4f41-83a2-fea530c34092%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.