Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 4887882

Browse files
committed
docs(api): missed files from alpha-32 update
1 parent 5588858 commit 4887882

File tree

288 files changed

+20862
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

288 files changed

+20862
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
.l-main-section
3+
h2 Attribute <span class="type">variable</span>
4+
p.location-badge.
5+
exported from <a href='../annotations'>angular2/annotations</a>
6+
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.32/modules/angular2/src/core/annotations/decorators.ts#L365-L365">angular2/src/core/annotations/decorators.ts (line 365)</a>
7+
8+
:markdown
9+
<a href='Attribute-var.html'><code>Attribute</code></a> factory function.
10+
11+
12+
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
2+
p.location-badge.
3+
exported from <a href='../annotations'>angular2/annotations</a>
4+
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.32/modules/angular2/src/core/annotations_impl/di.ts#L3-L44">angular2/src/core/annotations_impl/di.ts (line 3)</a>
5+
6+
:markdown
7+
Specifies that a constant attribute value should be injected.
8+
9+
The directive can inject constant string literals of host element attributes.
10+
11+
## Example
12+
13+
Suppose we have an `<input>` element and want to know its `type`.
14+
15+
```html
16+
<input type="text">
17+
```
18+
19+
A decorator can inject string literal `text` like so:
20+
21+
```javascript
22+
@Directive({
23+
selector: `input'
24+
})
25+
class InputDirective {
26+
constructor(@Attribute('type') type) {
27+
// type would be `text` in this example
28+
}
29+
}
30+
```
31+
32+
33+
.l-main-section
34+
h2 Members
35+
.l-sub-section
36+
h3 constructor
37+
38+
39+
pre.prettyprint
40+
code.
41+
constructor(attributeName: string)
42+
43+
:markdown
44+
45+
46+
47+
48+
49+
50+
.l-sub-section
51+
h3 attributeName
52+
53+
54+
:markdown
55+
56+
57+
58+
59+
60+
61+
62+
63+
.l-sub-section
64+
h3 token
65+
66+
67+
:markdown
68+
69+
70+
71+
72+
73+
74+
75+
76+
.l-sub-section
77+
h3 toString
78+
79+
80+
pre.prettyprint
81+
code.
82+
toString()
83+
84+
:markdown
85+
86+
87+
88+
89+
90+
91+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
p.location-badge.
3+
exported from <a href='../annotations'>angular2/annotations</a>
4+
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.32/modules/angular2/src/core/annotations/decorators.ts#L241-L292">angular2/src/core/annotations/decorators.ts (line 241)</a>
5+
6+
:markdown
7+
<a href='Attribute-var.html'><code>Attribute</code></a> factory for creating annotations, decorators or DSL.
8+
9+
## Example as TypeScript Decorator
10+
11+
```
12+
import {Attribute, Component, View} from "angular2/angular2";
13+
14+
@Component({...})
15+
@View({...})
16+
class MyComponent {
17+
constructor(@Attribute('title') title: string) {
18+
...
19+
}
20+
}
21+
```
22+
23+
## Example as ES5 DSL
24+
25+
```
26+
var MyComponent = ng
27+
.Component({...})
28+
.View({...})
29+
.Class({
30+
constructor: [new ng.Attribute('title'), function(title) {
31+
...
32+
}]
33+
})
34+
```
35+
36+
## Example as ES5 annotation
37+
38+
```
39+
var MyComponent = function(title) {
40+
...
41+
};
42+
43+
MyComponent.annotations = [
44+
new ng.Component({...})
45+
new ng.View({...})
46+
]
47+
MyComponent.parameters = [
48+
[new ng.Attribute('title')]
49+
]
50+
```
51+
52+
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
2+
.l-main-section
3+
h2(class="function export") Class
4+
5+
6+
pre.prettyprint
7+
code.
8+
Class(clsDef: ClassDefinition) : Type
9+
10+
11+
p.location-badge.
12+
exported from <a href='../annotations'>angular2/annotations</a>
13+
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.32/modules/angular2/src/util/decorators.ts#L124-L231">angular2/src/util/decorators.ts (line 124)</a>
14+
15+
:markdown
16+
Provides a way for expressing ES6 classes with parameter annotations in ES5.
17+
18+
## Basic Example
19+
20+
```
21+
var Greeter = ng.Class({
22+
constructor: function(name) {
23+
this.name = name;
24+
},
25+
26+
greet: function() {
27+
alert('Hello ' + this.name + '!');
28+
}
29+
});
30+
```
31+
32+
is equivalent to ES6:
33+
34+
```
35+
class Greeter {
36+
constructor(name) {
37+
this.name = name;
38+
}
39+
40+
greet() {
41+
alert('Hello ' + this.name + '!');
42+
}
43+
}
44+
```
45+
46+
or equivalent to ES5:
47+
48+
```
49+
var Greeter = function (name) {
50+
this.name = name;
51+
}
52+
53+
Greeter.prototype.greet = function () {
54+
alert('Hello ' + this.name + '!');
55+
}
56+
```
57+
58+
## Example with parameter annotations
59+
60+
```
61+
var MyService = neg.Class({
62+
constructor: [String, [new Query(), QueryList], function(name, queryList) {
63+
...
64+
}];
65+
});
66+
```
67+
68+
is equivalent to ES6:
69+
70+
```
71+
class MyService {
72+
constructor(name: string, @Query() queryList: QueryList) {
73+
...
74+
}
75+
}
76+
```
77+
78+
## Example with inheritance
79+
80+
```
81+
var Shape = ng.Class({
82+
constructor: (color) {
83+
this.color = color;
84+
}
85+
});
86+
87+
var Square = ng.Class({
88+
extends: Shape,
89+
constructor: function(color, size) {
90+
Shape.call(this, color);
91+
this.size = size;
92+
}
93+
});
94+
```
95+
96+
97+
98+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
p.location-badge.
3+
exported from <a href='../annotations'>angular2/annotations</a>
4+
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.32/modules/angular2/src/util/decorators.ts#L1-L22">angular2/src/util/decorators.ts (line 1)</a>
5+
6+
:markdown
7+
Declares the interface to be used with <a href='Class-function.html'><code>Class</code></a>.
8+
9+
10+
.l-main-section
11+
h2 Members
12+
.l-sub-section
13+
h3 extends?
14+
15+
16+
:markdown
17+
18+
Optional argument for specifying the superclass.
19+
20+
21+
22+
23+
24+
25+
26+
.l-sub-section
27+
h3 constructor
28+
29+
30+
:markdown
31+
32+
Required constructor function for a class.
33+
34+
The function may be optionally wrapped in an `Array`, in which case additional parameter
35+
annotations may be specified.
36+
The number of arguments and the number of parameter annotations must match.
37+
38+
See <a href='Class-function.html'><code>Class</code></a> for example of usage.
39+
40+
41+
42+
43+
44+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
.l-main-section
3+
h2 Component <span class="type">variable</span>
4+
p.location-badge.
5+
exported from <a href='../annotations'>angular2/annotations</a>
6+
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.32/modules/angular2/src/core/annotations/decorators.ts#L349-L350">angular2/src/core/annotations/decorators.ts (line 349)</a>
7+
8+
:markdown
9+
<a href='Component-var.html'><code>Component</code></a> factory function.
10+
11+
12+

0 commit comments

Comments
 (0)