docs(annotations): Added new text

This commit is contained in:
Naomi Black 2015-03-30 17:19:27 -07:00
parent ed5975d3e5
commit 3915e1b242
3 changed files with 36 additions and 9 deletions

View File

@ -445,18 +445,17 @@ export class Directive extends Injectable {
} }
/** /**
* Declare template views for an Angular application. * Declare reusable UI building blocks for an application.
* *
* Each angular component requires a single `@Component` and at least one `@Template` annotation. This allows Angular to * Each angular component requires a single `@Component` and at least one `@Template` annotation. The @Component
* encapsulate state information and templates. These form the fundamental reusable building blocks for developing an * annotation specifies when a component is instantiated, and which properties and events it binds to.
* application. There can only be one component per DOM element.
* *
* When a component is instantiated, Angular * When a component is instantiated, Angular
* - creates a shadow DOM for the component. * - creates a shadow DOM for the component.
* - loads the selected template into the shadow DOM. * - loads the selected template into the shadow DOM.
* - creates a child [Injector] which is configured with the [Component.services]. * - creates a child [Injector] which is configured with the [Component.services].
* *
* All template expressions and statments are then evaluted against the component instance. * All template expressions and statements are then evaluated against the component instance.
* *
* For details on the `@Template` annotation, see [Template]. * For details on the `@Template` annotation, see [Template].
* *

View File

@ -1,6 +1,34 @@
import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang'; import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang';
/** /**
* Declare the available HTML templates for an application.
*
* Each angular component requires a single `@Component` and at least one `@Template` annotation. The @Template
* annotation specifies the HTML template to use, and lists the directives that are active within the template.
*
* When a component is instantiated, the template is loaded into the component's shadow root, and the
* expressions and statements in the template are evaluated against the component.
*
* For details on the `@Component` annotation, see [Component].
*
* ## Example
*
* ```
* @Component({
* selector: 'greet'
* })
* @Template({
* inline: 'Hello {{name}}!'
* })
* class Greet {
* name: string;
*
* constructor() {
* this.name = 'World';
* }
* }
* ```
*
* @publicModule angular2/annotations * @publicModule angular2/annotations
*/ */
export class Template { export class Template {

View File

@ -148,8 +148,8 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
* An application is bootstrapped inside an existing browser DOM, typically `index.html`. Unlike Angular 1, Angular 2 * An application is bootstrapped inside an existing browser DOM, typically `index.html`. Unlike Angular 1, Angular 2
* does not compile/process bindings in `index.html`. This is mainly for security reasons, as well as architectural * does not compile/process bindings in `index.html`. This is mainly for security reasons, as well as architectural
* changes in Angular 2. This means that `index.html` can safely be processed using server-side technologies such as * changes in Angular 2. This means that `index.html` can safely be processed using server-side technologies such as
* bindings. (which may use double-curly `{{ syntax }}` without collision from Angular 2 component double-curly * bindings. Bindings can thus use double-curly `{{ syntax }}` without collision from Angular 2 component double-curly
* `{{ syntax }}`.) * `{{ syntax }}`.
* *
* We can use this script code: * We can use this script code:
* *
@ -204,8 +204,8 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
* *
* If you need to bootstrap multiple applications that share common data, the applications must share a common * If you need to bootstrap multiple applications that share common data, the applications must share a common
* change detection and zone. To do that, create a meta-component that lists the application components in its template. * change detection and zone. To do that, create a meta-component that lists the application components in its template.
* By only invoking the `bootstrap()` method once, with the meta-component as its argument, you ensure that only a single * By only invoking the `bootstrap()` method once, with the meta-component as its argument, you ensure that only a
* change detection zone is created and therefore data can be shared across the applications. * single change detection zone is created and therefore data can be shared across the applications.
* *
* *
* ## Primordial Injector * ## Primordial Injector