Use Angular Value Providers

Share this video with your friends

Send Tweet

Dependecies aren’t always objects created by classes or factory functions. Sometimes, all we really want is inject a simple value, which can be a primitive, or maybe just a configuration object. For these cases, we can use value providers and in this lesson we’ll discuss, how they are created.

sooey
sooey
~ 8 years ago

It may also be useful to know that in order for Typescript to render the necessary meta data, so that the Inject() attribute isn't needed, that the tsconfig needs to include: '"emitDecoratorMetadata": true. I hope this helps somebody. Also, thanks for the tutorial... great job!