docs(API): 改进标题行翻译方式

docs(API): 翻译了 directive.ts 中的所有 tsdoc
This commit is contained in:
Zhicheng Wang 2018-08-31 09:01:12 +08:00
parent fcfe9c581d
commit 2cd125f40c
6 changed files with 866 additions and 277 deletions

View File

@ -107,14 +107,7 @@ core/testing/async | 518 | 0.16
找到源码,并且把对应的 tsdoc 内容翻译了。
注意tsdoc 中的第一行是标题行编译时和其它内容不在一起所以tsdoc 注释中的第一行必须使用
```
english
<p>中文</p>
```
的形式进行翻译,后面的描述行则无所谓,可以按照以前的空行分隔的方式进行翻译。
中文放在英文之后,并且要隔一个空行。
## 翻译内容

View File

@ -12,7 +12,7 @@ module.exports = function splitDescription() {
docs.forEach(doc => {
if (this.docTypes.indexOf(doc.docType) !== -1 && doc.description !== undefined) {
const description = doc.description.trim();
const endOfParagraph = description.search(/\n\s*\n/);
const endOfParagraph = description.search(/\n\s*\n+(?!.*[\u4e00-\u9fa5])/); // 从第一个非汉字行开始拆分
if (endOfParagraph === -1) {
doc.shortDescription = description;
doc.description = '';

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,8 @@ export class NgForOfContext<T> {
* The `NgForOf` directive instantiates a template once per item from an iterable. The context
* for each instantiated template inherits from the outer context with the given loop variable
* set to the current item from the iterable.
* <p>`NgForOf` </p>
*
* `NgForOf`
*
* ### Local Variables
*

View File

@ -16,6 +16,8 @@ import {ViewEncapsulation} from './view';
/**
* Type of the Directive decorator / constructor function.
*
*
*/
export interface DirectiveDecorator {
/**
@ -25,13 +27,20 @@ export interface DirectiveDecorator {
* how the directive should be processed, instantiated and used at
* runtime.
*
* Angular DOM
* 使
*
* Directive classes, like component classes, can implement
* [life-cycle hoooks](guide/lifecycle-hooks) to influence their configuration and behavior.
*
* [](guide/lifecycle-hooks)
*
*
* @usageNotes
* To define a directive, mark the class with the decorator and provide metadata.
*
*
*
* ```
* import {Directive} from '@angular/core';
*
@ -45,14 +54,22 @@ export interface DirectiveDecorator {
*
* ### Declaring directives
*
* ###
*
* Directives are [declarables](guide/glossary#declarable).
* They must be declared by an NgModule
* in order to be usable in an app.
*
* [](guide/glossary#declarable)
* NgModule
*
* A directive must belong to exactly one NgModule. Do not re-declare
* a directive imported from another module.
* List the directive class in the `declarations` field of an NgModule.
*
* NgModule
* NgModule `declarations`
*
* ```
* declarations: [
* AppComponent,
@ -66,6 +83,8 @@ export interface DirectiveDecorator {
/**
* See the `Directive` decorator.
*
* `Directive`
*/
new (obj: Directive): Directive;
}
@ -74,20 +93,44 @@ export interface Directive {
/**
* The CSS selector that triggers the instantiation of a directive.
*
* CSS
*
* Declare as one of the following:
*
* 使
*
* - `element-name`: select by element name.
*
* `element-name`
*
* - `.class`: select by class name.
*
* `.class`
*
* - `[attribute]`: select by attribute name.
*
* `[attribute]`
*
* - `[attribute=value]`: select by attribute name and value.
*
* `[attribute=value]`
*
* - `:not(sub_selector)`: select only if the element does not match the `sub_selector`.
*
* `:not(sub_selector)` `sub_selector`
*
* - `selector1, selector2`: select if either `selector1` or `selector2` matches.
*
* `selector1, selector2` `selector1` `selector2`
*
* Angular only allows directives to trigger on CSS selectors that do not cross element
* boundaries. For example, consider a directive with an `input[type=text]` selector.
* For the following HTML, the directive is instantiated only on the
* `<input type="text">` element.
*
* Angular CSS `input[type=text]`
* HTML `<input type="text">`
*
* ```html
* <form>
* <input type="text">
@ -101,20 +144,36 @@ export interface Directive {
/**
* Enumerates the set of data-bound input properties for a directive
*
*
*
* Angular automatically updates input properties during change detection.
* The `inputs` property defines a set of `directiveProperty` to `bindingProperty`
* configuration:
*
* Angular
* `inputs` `directiveProperty` `bindingProperty`
*
* - `directiveProperty` specifies the component property where the value is written.
*
* `directiveProperty`
*
* - `bindingProperty` specifies the DOM property where the value is read from.
*
* `bindingProperty` DOM
*
* When `bindingProperty` is not provided, it is assumed to be equal to `directiveProperty`.
*
* `bindingProperty` `directiveProperty`
* @usageNotes
*
* ### Example
*
* ###
*
* The following example creates a component with two data-bound properties.
*
*
*
* ```typescript
* @Component({
* selector: 'bank-account',
@ -135,19 +194,32 @@ export interface Directive {
/**
* Enumerates the set of event-bound output properties.
*
*
*
* When an output property emits an event, an event handler attached to that event
* the template is invoked.
*
*
*
* The `outputs` property defines a set of `directiveProperty` to `bindingProperty`
* configuration:
*
* `outputs` `directiveProperty` `bindingProperty`
*
* - `directiveProperty` specifies the component property that emits events.
*
* `directiveProperty`
*
* - `bindingProperty` specifies the DOM property the event handler is attached to.
*
* `bindingProperty` DOM
*
* @usageNotes
*
* ### Example
*
* ###
*
* ```typescript
* @Directive({
* selector: 'child-dir',
@ -169,16 +241,22 @@ export interface Directive {
/**
* A set of injection tokens that allow the DI system to
* provide a dependency to this directive or component.
*
* DI
*/
providers?: Provider[];
/**
* Defines the name that can be used in the template to assign this directive to a variable.
*
*
*
* @usageNotes
*
* ### Simple Example
*
* ###
*
* ```
* @Directive({
* selector: 'child-dir',
@ -200,16 +278,25 @@ export interface Directive {
/**
* Configures the queries that will be injected into the directive.
*
*
*
* Content queries are set before the `ngAfterContentInit` callback is called.
* View queries are set before the `ngAfterViewInit` callback is called.
*
* `ngAfterContentInit`
* `ngAfterViewInit`
*
* @usageNotes
*
* ### Example
*
* ###
*
* The following example shows how queries are defined
* and when their results are available in lifecycle hooks:
*
*
*
* ```
* @Component({
* selector: 'someDir',
@ -241,7 +328,11 @@ export interface Directive {
* If true, this directive/component will be skipped by the AOT compiler and so will always be
* compiled using JIT.
*
* `true`/ AOT JIT
*
* This exists to support future Ivy work and has no effect currently.
*
* Ivy
*/
jit?: true;
}
@ -249,6 +340,8 @@ export interface Directive {
/**
* Directive decorator and metadata.
*
*
*
* @Annotation
*/
export interface Directive {
@ -256,21 +349,46 @@ export interface Directive {
* The CSS selector that identifies this directive in a template
* and triggers instantiation of the directive.
*
* CSS
*
* Declare as one of the following:
*
* 使
*
* - `element-name`: Select by element name.
*
* `element-name`
*
* - `.class`: Select by class name.
*
* `.class`
*
* - `[attribute]`: Select by attribute name.
*
* `[attribute]`
*
* - `[attribute=value]`: Select by attribute name and value.
*
* `[attribute=value]`
*
* - `:not(sub_selector)`: Select only if the element does not match the `sub_selector`.
*
* `:not(sub_selector)` `sub_selector`
*
* - `selector1, selector2`: Select if either `selector1` or `selector2` matches.
*
* `selector1, selector2` `selector1` `selector2`
*
* Angular only allows directives to apply on CSS selectors that do not cross
* element boundaries.
*
* Angular 使 CSS
*
* For the following template HTML, a directive with an `input[type=text]` selector,
* would be instantiated only on the `<input type="text">` element.
*
* HTML `input[type=text]` `<input type="text">`
*
* ```html
* <form>
* <input type="text">
@ -286,10 +404,20 @@ export interface Directive {
* When an output property emits an event, an event handler attached
* to that event in the template is invoked.
*
*
*
* Each output property maps a `directiveProperty` to a `bindingProperty`:
*
* `directiveProperty` `bindingProperty`
*
* - `directiveProperty` specifies the component property that emits events.
*
* `directiveProperty`
*
* - `bindingProperty` specifies the HTML attribute the event handler is attached to.
*
* `bindingProperty` HTML
*
*/
outputs?: string[];
@ -297,23 +425,43 @@ export interface Directive {
* Maps class properties to host element bindings for properties,
* attributes, and events, using a set of key-value pairs.
*
* 使-宿PropertyAttribute
*
* Angular automatically checks host property bindings during change detection.
* If a binding changes, Angular updates the directive's host element.
*
* Angular 宿 Property
* Angular 宿
*
* When the key is a property of the host element, the property value is
* the propagated to the specified DOM property.
*
* key 宿 Property Property DOM
*
* When the key is a static attribute in the DOM, the attribute value
* is propagated to the specified property in the host element.
*
* key DOM Attribute Attribute 宿 Property
*
* For event handling:
*
*
*
* - The key is the DOM event that the directive listens to.
* To listen to global events, add the target to the event name.
* The target can be `window`, `document` or `body`.
*
* key DOM
*
* `window``document` `body`
*
* - The value is the statement to execute when the event occurs. If the
* statement evalueates to `false`, then `preventDefault` is applied on the DOM
* event. A handler method can refer to the `$event` local variable.
*
* value `false` DOM `preventDefault`
* `$event`
*
*/
host?: {[key: string]: string};
@ -321,6 +469,8 @@ export interface Directive {
* Configures the [injector](guide/glossary#injector) of this
* directive or component with a [token](guide/glossary#di-token)
* that maps to a [provider](guide/glossary#provider) of a dependency.
*
* 使 [](guide/glossary#di-token) [](guide/glossary#injector)[](guide/glossary#provider)
*/
providers?: Provider[];
@ -328,21 +478,30 @@ export interface Directive {
* The name or names that can be used in the template to assign this directive to a variable.
* For multiple names, use a comma-separated string.
*
* 使
*
*/
exportAs?: string;
/**
* Configures the queries that will be injected into the directive.
*
*
*
* Content queries are set before the `ngAfterContentInit` callback is called.
* View queries are set before the `ngAfterViewInit` callback is called.
*
* `ngAfterContentInit`
* `ngAfterViewInit`
*
*/
queries?: {[key: string]: any};
}
/**
* Type of the Directive metadata.
*
*
*/
export const Directive: DirectiveDecorator = makeDecorator(
'Directive', (dir: Directive = {}) => dir, undefined, undefined,
@ -350,6 +509,7 @@ export const Directive: DirectiveDecorator = makeDecorator(
/**
* Component decorator interface
*
*
*/
export interface ComponentDecorator {
@ -358,44 +518,68 @@ export interface ComponentDecorator {
* metadata that determines how the component should be processed,
* instantiated, and used at runtime.
*
* Angular 使
*
* Components are the most basic UI building block of an Angular app.
* An Angular app contains a tree of Angular components.
*
* Angular UI Angular
*
* Angular components are a subset of directives, always associated with a template.
* Unlike other directives, only one component can be instantiated per an element in a template.
*
* Angular
*
* A component must belong to an NgModule in order for it to be available
* to another component or application. To make it a member of an NgModule,
* list it in the `declarations` field of the `@NgModule` metadata.
*
* NgModule 使
* NgModule `@NgModule` `declarations`
*
* Note that, in addition to these options for configuring a directive,
* you can control a component's runtime behavior by implementing
* life-cycle hooks. For more information, see the
* [Lifecycle Hooks](guide/lifecycle-hooks) guide.
*
*
* [](guide/lifecycle-hooks)
*
* @usageNotes
*
* ### Setting component inputs
*
* ###
*
* The following example creates a component with two data-bound properties,
* specified by the `inputs` value.
*
* `inputs`
*
* <code-example path="core/ts/metadata/directives.ts" region="component-input">
* </code-example>
*
*
* ### Setting component outputs
*
* ###
*
* The following example shows two event emitters that emit on an interval. One
* emits an output every second, while the other emits every five seconds.
*
*
*
* {@example core/ts/metadata/directives.ts region='component-output-interval'}
*
* ### Injecting a class with a view provider
*
* ### 使
*
* The following simple example injects a class into a component
* using the view provider specified in component metadata:
*
* 使
*
* ```
* class Greeter {
* greet(name:string) {
@ -432,22 +616,37 @@ export interface ComponentDecorator {
(obj: Component): TypeDecorator;
/**
* See the `@Component` decorator.
*
* `@Component`
*/
new (obj: Component): Component;
}
/**
* Supplies configuration metadata for an Angular component.
*
* Angular
*/
export interface Component extends Directive {
/**
* The change-detection strategy to use for this component.
*
*
*
* When a component is instantiated, Angular creates a change detector,
* which is responsible for propagating the component's bindings.
* The strategy is one of:
*
* Angular
*
*
* - `ChangeDetectionStrategy#OnPush` sets the strategy to `CheckOnce` (on demand).
*
* `ChangeDetectionStrategy#OnPush` `CheckOnce`
*
* - `ChangeDetectionStrategy#Default` sets the strategy to `CheckAlways`.
*
* `ChangeDetectionStrategy#Default` `CheckAlways`
*/
changeDetection?: ChangeDetectionStrategy;
@ -464,6 +663,8 @@ export interface Component extends Directive {
* SystemJS exposes the `__moduleName` variable within each module.
* In CommonJS, this can be set to `module.id`.
*
* ID使 URL
* SystemJS `__moduleName` CommonJS `module.id`
*/
moduleId?: string;
@ -471,6 +672,7 @@ export interface Component extends Directive {
* The URL of a template file for an Angular component. If provided,
* do not supply an inline template using `template`.
*
* URL `template`
*/
templateUrl?: string;
@ -478,18 +680,23 @@ export interface Component extends Directive {
* An inline template for an Angular component. If provided,
* do not supply a template file using `templateUrl`.
*
* `templateUrl`
*/
template?: string;
/**
* One or more URLs for files containing CSS stylesheets to use
* in this component.
*
* URL CSS
*/
styleUrls?: string[];
/**
* One or more inline CSS stylesheets to use
* in this component.
*
* CSS
*/
styles?: string[];
@ -498,28 +705,47 @@ export interface Component extends Directive {
* `state()` and `transition()` definitions.
* See the [Animations guide](/guide/animations) and animations API documentation.
*
* `trigger()` `state()` `transition()`
* [](/guide/animations) API
*/
animations?: any[];
/**
* An encapsulation policy for the template and CSS styles. One of:
*
* CSS 使
*
* - `ViewEncapsulation.Native`: Use shadow roots. This works
* only if natively available on the platform.
*
* `ViewEncapsulation.Native`使 Shadow DOM Shadow DOM
*
* - `ViewEncapsulation.Emulated`: Use shimmed CSS that
* emulates the native behavior.
*
* `ViewEncapsulation.Emulated`使shimmed) CSS
*
* - `ViewEncapsulation.None`: Use global CSS without any
* encapsulation.
*
* `ViewEncapsulation.None`使 CSS
*
* If not supplied, the value is taken from `CompilerOptions`. The default compiler option is
* `ViewEncapsulation.Emulated`.
*
* `CompilerOptions` `ViewEncapsulation.Emulated`
*
* If the policy is set to `ViewEncapsulation.Emulated` and the component has no `styles`
* or `styleUrls` specified, the policy is automatically switched to `ViewEncapsulation.None`.
*
* `ViewEncapsulation.Emulated` `styles` `styleUrls` `ViewEncapsulation.None`
*/
encapsulation?: ViewEncapsulation;
/**
* Overrides the default encapsulation start and end delimiters (`{{` and `}}`)
*
* `{{` `}}`
*/
interpolation?: [string, string];
@ -528,6 +754,8 @@ export interface Component extends Directive {
* this component. For each component listed here,
* Angular creates a {@link ComponentFactory} and stores it in the
* {@link ComponentFactoryResolver}.
*
* Angular {@link ComponentFactory} {@link ComponentFactoryResolver}
*/
entryComponents?: Array<Type<any>|any[]>;
@ -536,6 +764,9 @@ export interface Component extends Directive {
* from the compiled template. Whitespace characters are those matching the `\s`
* character class in JavaScript regular expressions. Default is false, unless
* overridden in compiler options.
*
* `true` `false`
* JavaScript `\s` `false`
*/
preserveWhitespaces?: boolean;
}
@ -543,15 +774,22 @@ export interface Component extends Directive {
/**
* Component decorator and metadata.
*
*
*
* @usageNotes
*
* ### Using animations
*
* ### 使
*
* The following snippet shows an animation trigger in a component's
* metadata. The trigger is attached to an element in the component's
* template, using "@_trigger_name_", and a state expression that is evaluated
* at run time to determine whether the animation should start.
*
*
* 使 "@_trigger_name_"
*
* ```typescript
* @Component({
* selector: 'animation-cmp',
@ -575,28 +813,54 @@ export interface Component extends Directive {
*
* ### Preserving whitespace
*
* ###
*
* Removing whitespace can greatly reduce AOT-generated code size, and speed up view creation.
* As of Angular 6, default for `preserveWhitespaces` is false (whitespace is removed).
* To change the default setting for all components in your application, set
* the `preserveWhitespaces` option of the AOT compiler.
*
* AOT
* Angular 6`preserveWhitespaces` `false`
* AOT `preserveWhitespaces`
*
* Current implementation removes whitespace characters as follows:
*
*
*
* - Trims all whitespaces at the beginning and the end of a template.
*
*
*
* - Removes whitespace-only text nodes. For example,
* `<button>Action 1</button> <button>Action 2</button>` becomes
* `<button>Action 1</button><button>Action 2</button>`.
*
*
* `<button>Action 1</button> <button>Action 2</button>`
* `<button>Action 1</button><button>Action 2</button>`.
*
* - Replaces a series of whitespace characters in text nodes with a single space.
* For example, `<span>\n some text\n</span>` becomes `<span> some text </span>`.
*
* `<span>\n some text\n</span>` `<span> some text </span>`
*
* - Does NOT alter text nodes inside HTML tags such as `<pre>` or `<textarea>`,
* where whitespace characters are significant.
*
* HTML `<pre>` `<textarea>`
*
* Note that these transformations can influence DOM nodes layout, although impact
* should be minimal.
*
* DOM
*
* You can override the default behavior to preserve whitespace characters
* in certain fragments of a template. For example, you can exclude an entire
* DOM sub-tree by using the `ngPreserveWhitespaces` attribute:
*
* 使 `ngPreserveWhitespaces` DOM
*
* ```html
* <div ngPreserveWhitespaces>
* whitespaces are preserved here
@ -608,6 +872,8 @@ export interface Component extends Directive {
* which is replaced with a space character by Angular's template
* compiler:
*
* 使 `&ngsp;` `&ngsp;` Angular
*
* ```html
* <a>Spaces</a>&ngsp;<a>between</a>&ngsp;<a>links.</a>
* <!-->compiled to be equivalent to:</>
@ -617,6 +883,8 @@ export interface Component extends Directive {
* Note that sequences of `&ngsp;` are still collapsed to just one space character when
* the `preserveWhitespaces` option is set to `false`.
*
* 使 `preserveWhitespaces` `false``&ngsp;`
*
* ```html
* <a>before</a>&ngsp;&ngsp;&ngsp;<a>after</a>
* <!-->compiled to be equivalent to:</>
@ -626,6 +894,8 @@ export interface Component extends Directive {
* To preserve sequences of whitespace characters, use the
* `ngPreserveWhitespaces` attribute.
*
* 使 `ngPreserveWhitespaces`
*
* @Annotation
*/
export const Component: ComponentDecorator = makeDecorator(
@ -635,27 +905,35 @@ export const Component: ComponentDecorator = makeDecorator(
/**
* Type of the Pipe decorator / constructor function.
*
* Pipe
*/
export interface PipeDecorator {
/**
* Declares a reusable pipe function, and supplies configuration metadata.
*
* pipe
*/
(obj: Pipe): TypeDecorator;
/**
* See the `Pipe` decorator.
*
* `Pipe`
*/
new (obj: Pipe): Pipe;
}
/**
* Type of the Pipe metadata.
*
* Pipe
*/
export interface Pipe {
/**
* The pipe name to use in template bindings.
*
* 使
*/
name: string;
@ -664,10 +942,15 @@ export interface Pipe {
* `transform()` method is invoked only when its input arguments
* change. Pipes are pure by default.
*
* `true` `transform()`
*
* If the pipe has internal state (that is, the result
* depends on state other than its arguments), set `pure` to false.
* In this case, the pipe is invoked on each change-detection cycle,
* even if the arguments have not changed.
*
* `pure` `false`
* 使
*/
pure?: boolean;
}
@ -689,20 +972,28 @@ export interface InputDecorator {
/**
* Decorator that marks a class as pipe and supplies configuration metadata.
*
*
*
* A pipe class must implement the `PipeTransform` interface.
* For example, if the name is "myPipe", use a template binding expression
* such as the following:
*
* `PipeTransform`
* "myPipe"
*
* ```
* {{ exp | myPipe }}
* ```
*
* The result of the expression is passed to the pipe's `transform()` method.
*
* `transform()`
*
* A pipe must belong to an NgModule in order for it to be available
* to a template. To make it a member of an NgModule,
* list it in the `declarations` field of the `@NgModule` metadata.
*
* NgModule 使 NgModule `@NgModule` `declarations`
*/
(bindingPropertyName?: string): any;
new (bindingPropertyName?: string): any;
@ -711,6 +1002,7 @@ export interface InputDecorator {
/**
* Type of metadata for an `Input` property.
*
* `Input`
*
*/
export interface Input {
@ -719,6 +1011,9 @@ export interface Input {
* Declares a data-bound input property, which Angular automatically updates
* during change detection.
*
*
* Angular
*
* @usageNotes
*
* You can supply an optional name to use in templates when the
@ -726,9 +1021,14 @@ export interface Input {
* name of the bound property. By default, the original
* name of the bound property is used for input binding.
*
* 使
*
*
* The following example creates a component with two input properties,
* one of which is given a special binding name.
*
*
*
* ```typescript
* @Component({
* selector: 'bank-account',
@ -770,6 +1070,8 @@ export const Input: InputDecorator =
/**
* Type of the Output decorator / constructor function.
*
* `Output`
*/
export interface OutputDecorator {
/**
@ -777,6 +1079,9 @@ export interface OutputDecorator {
* Declares a data-bound output property, which Angular automatically updates
* during change detection.
*
*
* Angular
*
* @usageNotes
*
* You can supply an optional name to use in templates when the
@ -784,8 +1089,12 @@ export interface OutputDecorator {
* name of the bound property. By default, the original
* name of the bound property is used for output binding.
*
* 使
*
*
* See `@Input` decorator for an example of providing a binding name.
*
* `@Input`
*/
(bindingPropertyName?: string): any;
new (bindingPropertyName?: string): any;
@ -793,6 +1102,8 @@ export interface OutputDecorator {
/**
* Type of the Output metadata.
*
* `Output`
*/
export interface Output { bindingPropertyName?: string; }
@ -806,6 +1117,9 @@ export const Output: OutputDecorator =
/**
* Type of the HostBinding decorator / constructor function.
*
* HostBinding
*
*/
export interface HostBindingDecorator {
/**
@ -814,11 +1128,16 @@ export interface HostBindingDecorator {
* Angular automatically checks host property bindings during change detection, and
* if a binding changes it updates the host element of the directive.
*
* DOM 宿
* Angular 宿宿
*
* @usageNotes
*
* The following example creates a directive that sets the `valid` and `invalid`
* properties on the DOM element that has an `ngModel` directive on it.
*
* `ngModel` DOM `valid` `invalid`
*
* ```typescript
* @Directive({selector: '[ngModel]'})
* class NgModelStatus {
@ -843,6 +1162,8 @@ export interface HostBindingDecorator {
/**
* Type of the HostBinding metadata.
*
* HostBinding
*
*/
export interface HostBinding { hostPropertyName?: string; }
@ -856,6 +1177,8 @@ export const HostBinding: HostBindingDecorator =
/**
* Type of the HostListener decorator / constructor function.
*
* HostListener
*/
export interface HostListenerDecorator {
(eventName: string, args?: string[]): any;
@ -864,14 +1187,20 @@ export interface HostListenerDecorator {
/**
* Type of the HostListener metadata.
*
* HostListener
*/
export interface HostListener {
/**
* The CSS event to listen for.
*
*
*/
eventName?: string;
/**
* A set of arguments to pass to the handler method when the event occurs.
*
*
*/
args?: string[];
}
@ -882,11 +1211,17 @@ export interface HostListener {
* and updates the bound element with the result.
* If the handler method returns false, applies `preventDefault` on the bound element.
*
* 宿
* 宿Angular 使
* `false` `preventDefault`
*
* @usageNotes
*
* The following example declares a directive
* that attaches a click listener to a button and counts clicks.
*
* `click`
*
* ```
* @Directive({selector: 'button[counting]'})
* class CountClicks {

View File

@ -29,7 +29,8 @@ export const formControlBinding: any = {
/**
* `ngModel` forces an additional change detection run when its inputs change:
* E.g.:
* <p>`ngModel` </p>
*
* `ngModel`
* ```
* <div>{{myModel.valid}}</div>
* <input [(ngModel)]="myValue" #myModel="ngModel">
@ -64,7 +65,8 @@ const resolvedPromise = Promise.resolve(null);
*
* Creates a `FormControl` instance from a domain model and binds it
* to a form control element.
* <p> `FormControl` </p>
*
* `FormControl`
*
* The `FormControl` instance will track the value, user interaction, and
* validation status of the control and keep the view synced with the model. If used
@ -171,7 +173,8 @@ export class NgModel extends NgControl implements OnChanges,
/**
* Options object for this `ngModel` instance. You can configure the following properties:
* <p> `ngModel` </p>
*
* `ngModel`
*
* **name**: An alternative to setting the name attribute on the form control element.
* Sometimes, especially with custom form components, the name attribute might be used