docs: add DI to public docs
This commit is contained in:
6
modules/angular2/src/core/annotations/di.js
vendored
6
modules/angular2/src/core/annotations/di.js
vendored
@ -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
|
||||
*/
|
||||
|
55
modules/angular2/src/core/annotations/view.js
vendored
55
modules/angular2/src/core/annotations/view.js
vendored
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,6 @@ import {isPresent} from 'angular2/src/facade/lang';
|
||||
* lifecycle.tick();
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @exportedAs angular2/change_detection
|
||||
*/
|
||||
@Injectable()
|
||||
|
Reference in New Issue
Block a user