Injectablelink
A marker metadata that marks a class as available to Injector for creation.
标记性元数据,表示一个类可以由 Injector 进行创建。
| 选项 | 说明 |
|---|---|
providedIn |
说明
For more details, see the "Dependency Injection Guide".
欲知详情,参见"依赖注入"。
使用说明
Example
范例
Injector will throw an error when trying to instantiate a class that does not have @Injectable marker, as shown in the example below.
Injector在试图实例化一个不带 @Injectable 标记的类时,就会抛出一个错误,如下面的例子所示。