docs(API): 翻译 injectable
This commit is contained in:
parent
b3991897d8
commit
2408128394
|
@ -17,7 +17,7 @@
|
|||
[ ] |forms/FormsModule | 3,381 | 1.05
|
||||
[x] |core/Input | 3,354 | 1.04
|
||||
[x] |core/EventEmitter | 3,202 | 0.99
|
||||
[ ] |core/Injectable | 3,177 | 0.99
|
||||
[x] |core/Injectable | 3,177 | 0.99
|
||||
[ ] |forms/FormGroup | 3,096 | 0.96
|
||||
[ ] |forms/FormControl | 3,034 | 0.94
|
||||
[ ] |router/ActivatedRoute | 2,993 | 0.93
|
||||
|
|
|
@ -23,6 +23,8 @@ const USE_VALUE = getClosureSafeProperty<ValueProvider>(
|
|||
/**
|
||||
* Injectable providers used in `@Injectable` decorator.
|
||||
*
|
||||
* `@Injectable` 装饰器中使用的可注入对象提供商。
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export type InjectableProvider = ValueSansProvider | ExistingSansProvider |
|
||||
|
@ -30,21 +32,31 @@ export type InjectableProvider = ValueSansProvider | ExistingSansProvider |
|
|||
|
||||
/**
|
||||
* Type of the Injectable decorator / constructor function.
|
||||
*
|
||||
* Injectable 装饰器的类型和构造函数
|
||||
*/
|
||||
export interface InjectableDecorator {
|
||||
/**
|
||||
* A marker metadata that marks a class as available to `Injector` for creation.
|
||||
*
|
||||
* 标记性元数据,表示一个类可以由 `Injector` 进行创建。
|
||||
*
|
||||
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
|
||||
*
|
||||
* 欲知详情,参见["依赖注入"](guide/dependency-injection)。
|
||||
*
|
||||
* @usageNotes
|
||||
* ### Example
|
||||
*
|
||||
* ### 范例
|
||||
*
|
||||
* {@example core/di/ts/metadata_spec.ts region='Injectable'}
|
||||
*
|
||||
* `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` 标记的类时,就会抛出一个错误,如下面的例子所示。
|
||||
*
|
||||
* {@example core/di/ts/metadata_spec.ts region='InjectableThrows'}
|
||||
*
|
||||
*/
|
||||
|
@ -57,6 +69,8 @@ export interface InjectableDecorator {
|
|||
/**
|
||||
* Type of the Injectable metadata.
|
||||
*
|
||||
* Injectable 元数据的类型。
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export interface Injectable { providedIn?: Type<any>|'root'|null; }
|
||||
|
@ -101,6 +115,8 @@ export function convertInjectableProviderToFactory(
|
|||
|
||||
/**
|
||||
* Supports @Injectable() in JIT mode for Render2.
|
||||
*
|
||||
* 在 JIT 模式下为 Render2 提供 `@Injectable()` 支持。
|
||||
*/
|
||||
function preR3InjectableCompile(
|
||||
injectableType: InjectableType<any>,
|
||||
|
@ -116,6 +132,8 @@ function preR3InjectableCompile(
|
|||
/**
|
||||
* Injectable decorator and metadata.
|
||||
*
|
||||
* Injectable 的装饰器和元数据。
|
||||
*
|
||||
* @Annotation
|
||||
*/
|
||||
export const Injectable: InjectableDecorator = makeDecorator(
|
||||
|
@ -126,6 +144,8 @@ export const Injectable: InjectableDecorator = makeDecorator(
|
|||
/**
|
||||
* Type representing injectable service.
|
||||
*
|
||||
* 表示可注入服务的类型。
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export interface InjectableType<T> extends Type<T> { ngInjectableDef: InjectableDef<T>; }
|
||||
|
|
|
@ -17,7 +17,7 @@ import {ViewEncapsulation} from './view';
|
|||
/**
|
||||
* Type of the Directive decorator / constructor function.
|
||||
*
|
||||
* 指令装饰器、构造函数的类型。
|
||||
* 指令装饰器的类型和构造函数。
|
||||
*/
|
||||
export interface DirectiveDecorator {
|
||||
/**
|
||||
|
@ -908,7 +908,7 @@ export const Component: ComponentDecorator = makeDecorator(
|
|||
/**
|
||||
* Type of the Pipe decorator / constructor function.
|
||||
*
|
||||
* Pipe 装饰器、构造函数的类型
|
||||
* Pipe 装饰器的类型和构造函数。
|
||||
*/
|
||||
export interface PipeDecorator {
|
||||
/**
|
||||
|
@ -1073,7 +1073,7 @@ export const Input: InputDecorator =
|
|||
/**
|
||||
* Type of the Output decorator / constructor function.
|
||||
*
|
||||
* `Output` 装饰器、构造函数的类型。
|
||||
* `Output` 装饰器的类型和构造函数。
|
||||
*/
|
||||
export interface OutputDecorator {
|
||||
/**
|
||||
|
@ -1120,7 +1120,7 @@ export const Output: OutputDecorator =
|
|||
/**
|
||||
* Type of the HostBinding decorator / constructor function.
|
||||
*
|
||||
* HostBinding 装饰器、构造函数的类型。
|
||||
* HostBinding 装饰器的类型和构造函数。
|
||||
*
|
||||
*/
|
||||
export interface HostBindingDecorator {
|
||||
|
@ -1180,7 +1180,7 @@ export const HostBinding: HostBindingDecorator =
|
|||
/**
|
||||
* Type of the HostListener decorator / constructor function.
|
||||
*
|
||||
* HostListener 装饰器、构造函数的类型
|
||||
* HostListener 装饰器的类型和构造函数。
|
||||
*/
|
||||
export interface HostListenerDecorator {
|
||||
(eventName: string, args?: string[]): any;
|
||||
|
|
Loading…
Reference in New Issue