viewProviders property
Defines the set of injectable objects that are visible to its view DOM children.
Simple Example
Here is an example of a class that can be injected:
class Greeter {
greet(String name) => 'Hello ${name}!';
}
@Directive(
selector: 'needs-greeter'
)
class NeedsGreeter {
final Greeter greeter;
NeedsGreeter(this.greeter);
}
@Component(
selector: 'greet',
viewProviders: [
Greeter
],
template: '<needs-greeter></needs-greeter>',
directives: [NeedsGreeter]
)
class HelloWorld {
}
Implementation
final List<Object> viewProviders;