162 lines
3.0 KiB
Plaintext
162 lines
3.0 KiB
Plaintext
|
|
p.location-badge.
|
|
exported from <a href='../metadata'>angular2/metadata</a>
|
|
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.36/modules/angular2/src/core/metadata/view.ts#L4-L117">angular2/src/core/metadata/view.ts (line 4)</a>
|
|
|
|
:markdown
|
|
Annotations provide the additional information that Angular requires in order to run your
|
|
application. This module
|
|
contains <a href='ComponentMetadata-class.html'><code>ComponentMetadata</code></a>, <a href='DirectiveMetadata-class.html'><code>DirectiveMetadata</code></a>, and <a href='ViewMetadata-class.html'><code>ViewMetadata</code></a>
|
|
annotations, as well as
|
|
the <a href='../di/Host-var.html'><code>Host</code></a> annotation that is used by Angular to resolve dependencies.
|
|
|
|
.l-main-section
|
|
h2 Annotations
|
|
.l-sub-section
|
|
h3.annotation CONST
|
|
pre.prettyprint
|
|
code.
|
|
@CONST()
|
|
|
|
|
|
.l-main-section
|
|
h2 Members
|
|
.l-sub-section
|
|
h3 constructor
|
|
|
|
|
|
pre.prettyprint
|
|
code.
|
|
constructor({templateUrl, template, directives, pipes, encapsulation, styles, styleUrls}?: {
|
|
templateUrl?: string,
|
|
template?: string,
|
|
directives?: Array<Type | any | any[]>,
|
|
pipes?: Array<Type | any | any[]>,
|
|
encapsulation?: ViewEncapsulation,
|
|
styles?: string[],
|
|
styleUrls?: string[],
|
|
})
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 templateUrl
|
|
|
|
|
|
:markdown
|
|
Specifies a template URL for an angular component.
|
|
|
|
NOTE: either `templateUrl` or `template` should be used, but not both.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 template
|
|
|
|
|
|
:markdown
|
|
Specifies an inline template for an angular component.
|
|
|
|
NOTE: either `templateUrl` or `template` should be used, but not both.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 styleUrls
|
|
|
|
|
|
:markdown
|
|
Specifies stylesheet URLs for an angular component.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 styles
|
|
|
|
|
|
:markdown
|
|
Specifies an inline stylesheet for an angular component.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 directives
|
|
|
|
|
|
:markdown
|
|
Specifies a list of directives that can be used within a template.
|
|
|
|
Directives must be listed explicitly to provide proper component encapsulation.
|
|
|
|
|
|
|
|
```javascript
|
|
@Component({
|
|
selector: 'my-component'
|
|
})
|
|
@View({
|
|
directives: [For]
|
|
template: '
|
|
<ul>
|
|
<li *ng-for="#item of items">{{item}}</li>
|
|
</ul>'
|
|
})
|
|
class MyComponent {
|
|
}
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 pipes
|
|
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 encapsulation
|
|
|
|
|
|
:markdown
|
|
Specify how the template and the styles should be encapsulated.
|
|
The default is <a href='ViewEncapsulation-enum.html#Emulated'>`ViewEncapsulation.Emulated`</a> if the view
|
|
has styles,
|
|
otherwise <a href='ViewEncapsulation-enum.html#None'>`ViewEncapsulation.None`</a>.
|
|
|
|
|
|
|
|
|
|
|
|
|