docs(API): 翻译 injectable

This commit is contained in:
Zhicheng Wang 2018-08-31 18:31:27 +08:00
parent b3991897d8
commit 2408128394
3 changed files with 26 additions and 6 deletions

View File

@ -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

View File

@ -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>; }

View File

@ -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;