Tuesday 3 November 2020

Angular Interface for Service in HTML Selector

How do I provide Dependency Injection through a HTML Selector? Following answer is through typescript.

https://stackoverflow.com/a/40068594/14432516

providers: [
  { provide: ISearchService, useValue: SearchInFemaleEmployeeService}
]

I want to do something similar in html from Parent, and use Male/Female Employee Search Service. Parent component has this html.

<app-search-component>
</app-search-component>

I read it can be done through Module? However, this Module calls Search Component many times in html, and may require Male Or FemaleEmployee Search Service.



from Angular Interface for Service in HTML Selector

No comments:

Post a Comment