damirarh / damirscorner-utterances

utteranc.es comments for https://damirscorner.com
0 stars 0 forks source link

/blog/posts/20190510-SwitchingAngularServicesAtRuntime.html #89

Open damirarh opened 1 year ago

damirarh commented 1 year ago

Imported

URL: https://www.damirscorner.com/blog/posts/20190510-SwitchingAngularServicesAtRuntime.html

damirarh commented 1 year ago

Imported comment written by Lars Gyrup Brink Nielsen on 2019-05-12T21:35:48

We can switch providers at runtime by using element injectors to override module injector in parts of the component tree.

This would have to be expressed in the template. Conditional branches with the same content is not often very pretty in Angular component templates.

The most clean way would probably be to have the content in a template and use the NgTemplateOutlet structural directive or an Angular CDK Portal Outlet to render the content template.

damirarh commented 1 year ago

Imported comment written by Damir Arh on 2019-05-15T20:09:03

Thank you for the comment. I wasn't aware of element injectors. I'll read up on them.

damirarh commented 1 year ago

Imported comment written by Lars Gyrup Brink Nielsen on 2019-06-05T21:47:43

Grab a cup of coffee, sit in a comfortable chair and make sure you have enough time to enjoy this comprehensive work by Alexey Zuev:
https://blog.angularindepth...