docs: add DI to public docs

This commit is contained in:
Misko Hevery
2015-04-15 22:35:38 +00:00
parent 487c4d23c1
commit 87ac100c66
17 changed files with 581 additions and 105 deletions

View File

@ -30,13 +30,13 @@ export class PropertySetter extends DependencyAnnotation {
*
* ## Example
*
* suppose we have an `<input>` element and would like to know its `type`.
* Suppose we have an `<input>` element and want to know its `type`.
*
* ```html
* <input type="text">
* ```
*
* A decorator could inject string literal `text` like so:
* A decorator can inject string literal `text` like so:
*
* ```javascript
* @Decorator({
@ -71,7 +71,7 @@ export class Attribute extends DependencyAnnotation {
/**
* Specifies that a [QueryList] should be injected.
*
* See: [QueryList] for usage.
* See: [QueryList] for usage and example.
*
* @exportedAs angular2/annotations
*/

View File

@ -33,38 +33,57 @@ import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang';
* @exportedAs angular2/annotations
*/
export class View {
/**
* Specify a template URL for an angular component.
*
* NOTE: either `templateURL` or `template` should be used, but not both.
*/
templateUrl:any; //string;
/**
* Specify an inline template for an angular component.
*
* NOTE: either `templateURL` or `template` should be used, but not both.
*/
template:any; //string;
/**
* Specify a list of directives that are active within a template. [TODO: true?]
*
* Directives must be listed explicitly to provide proper component encapsulation.
*
* ## Example
*
* ```javascript
* @Component({
* selector: 'my-component'
* })
* @View({
* directives: [For]
* template: '
* <ul>
* <li *for="item in items">{{item}}</li>
* </ul>'
* })
* class MyComponent {
* }
* ```
*/
directives:any; //List<Type>;
formatters:any; //List<Type>;
source:any;//List<View>;
locale:any; //string
device:any; //string
@CONST()
constructor({
templateUrl,
template,
directives,
formatters,
source,
locale,
device
directives
}: {
templateUrl: string,
template: string,
directives: List<Type>,
formatters: List<Type>,
source: List<View>,
locale: string,
device: string
directives: List<Type>
})
{
this.templateUrl = templateUrl;
this.template = template;
this.directives = directives;
this.formatters = formatters;
this.source = source;
this.locale = locale;
this.device = device;
}
}

View File

@ -26,8 +26,6 @@ import {isPresent} from 'angular2/src/facade/lang';
* lifecycle.tick();
* });
* ```
*
*
* @exportedAs angular2/change_detection
*/
@Injectable()