Where does the Angular DI useFactory() context come from?

48 Views Asked by At

With angular (per this article) useFactory() can be used to add decision making on what to provide the component with during DI. Here's an example from the article:

useFactory: ()=> { if( ... ) return firstObject ... }

My question is where does the context for the if block come from? Since the component is not created yet, it cannot be component state ... It would be nice to see a more concrete example ...Thoughts?

0

There are 0 best solutions below