Skip to content

Commit ece3cb2

Browse files
committed
Added the actual API for angular2
1 parent e0b7903 commit ece3cb2

File tree

3 files changed

+234
-2
lines changed

3 files changed

+234
-2
lines changed

docs/angular-meteor/client/content/api-reference/angular2-meteor/0.4.2/api.bootstrap.html

+38
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
This is a wrapper for Angular2 `bootstrap`, which documented [here](https://angular.io/docs/ts/latest/api/platform/browser/bootstrap-function.html).
1616

17+
#### Usage Example
18+
1719
When working with TypeScript, import `bootstrap` method from `angular2-meteor` package, as follow:
1820

1921
import {bootstrap} from 'angular2-meteor';
@@ -33,6 +35,42 @@
3335
bootstrap(App);
3436

3537

38+
## API Reference
39+
40+
<table class="variables-matrix input-arguments">
41+
<thead>
42+
<tr>
43+
<th>Argument Name</th>
44+
<th>Type</th>
45+
<th>Description</th>
46+
<th>Default Value</th>
47+
<th>Required</th>
48+
</tr>
49+
</thead>
50+
<tbody>
51+
<tr>
52+
<td><strong>appComponentType</strong></td>
53+
<td>
54+
<a href="" class="label type-hint type-hint-class">class</a>
55+
</td>
56+
<td><p> The root component which should act as the application.</p>
57+
58+
</td>
59+
<td><a href="" class="label type-hint type-hint-object">Yes</a></td>
60+
</tr>
61+
<tr>
62+
<td>customProviders</td>
63+
<td>
64+
<a href="" class="label type-hint type-hint-array">array</a>
65+
</td>
66+
<td><p> An additional set of providers that can be added to the app injector to override default injection behavior. </p>
67+
68+
</td>
69+
<td></td>
70+
<td><a href="" class="label type-hint type-hint-object">No</a></td>
71+
</tr>
72+
</tbody>
73+
</table>
3674

3775
{{/markdown}}
3876

docs/angular-meteor/client/content/api-reference/angular2-meteor/0.4.2/api.meteorComponent.html

+195-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,201 @@
88
<do-nothing>
99
{{#markdown}}
1010

11-
MeteorComponent
11+
# MeteorComponent
12+
13+
MeteorComponent is a class to extend, you should extend this class by your implemented `@Component`s.
14+
15+
This class provides the ability to use Meteor along with Angular 2.0 - you can use Meteor abilities with the required environment configuration for Angular 2.0.
16+
17+
This basic component also handles the cleanup and destroy process that Angular 2.0 provides.
18+
19+
When using TypeScript, import this component as `MeteorComponent`, from `angular2-meteor` module:
20+
21+
import {MeteorComponent} from 'angular2-meteor';
22+
23+
#### Usage example
24+
25+
@Component({
26+
selector: 'my-component'
27+
})
28+
@View({
29+
template: 'Hello World!'
30+
})
31+
class MyComponent extends MeteorComponent {
32+
constructor() {
33+
super();
34+
35+
// Wrapper for Meteor.autorun
36+
this.autorun(() => {
37+
// Meteor dependant code
38+
});
39+
40+
// Wrapper for Meteor.call
41+
this.call('myServerMethod');
42+
43+
// Wrapper for Meteor.subscribe
44+
this.subscribe('mySubscription');
45+
}
46+
}
47+
48+
## API Reference
49+
50+
### autorun
51+
52+
This method is a wrapper of [Tracker.autorun](http://docs.meteor.com/#/full/tracker_autorun).
53+
54+
The first argument of this method is a callback, which will be called each time Autorun will be triggered.
55+
56+
The Autorun will stop automatically when when it's component is destroyed.
57+
58+
<table class="variables-matrix input-arguments">
59+
<thead>
60+
<tr>
61+
<th>Argument Name</th>
62+
<th>Type</th>
63+
<th>Description</th>
64+
<th>Default Value</th>
65+
<th>Required</th>
66+
</tr>
67+
</thead>
68+
<tbody>
69+
<tr>
70+
<td><strong>runFunc</strong></td>
71+
<td>
72+
<a href="" class="label type-hint type-hint-function">function</a>
73+
</td>
74+
<td><p> The function to run. It receives one argument: the Computation object that will be returned. </p>
75+
</td>
76+
<td></td>
77+
<td><a href="" class="label type-hint type-hint-object">Yes</a></td>
78+
</tr>
79+
<tr>
80+
<td>autoBind</td>
81+
<td>
82+
<a href="" class="label type-hint type-hint-boolean">boolean</a>
83+
</td>
84+
<td><p> Boolean that specify if to bind the callback to the NgZone of the component. </p>
85+
</td>
86+
<td>false</td>
87+
<td><a href="" class="label type-hint type-hint-object">No</a></td>
88+
</tr>
89+
</tbody>
90+
</table>
91+
92+
### subscribe
93+
94+
This method is a wrapper of [Tracker.subscribe](http://docs.meteor.com/#/full/meteor_subscribe).
95+
96+
The method expect the publication name (as defined in the server), subscription arguments, result callback and boolean that indicates that auto-bind feature.
97+
98+
The subscription will stop automatically when when it's component is destroyed.
99+
100+
<table class="variables-matrix input-arguments">
101+
<thead>
102+
<tr>
103+
<th>Argument Name</th>
104+
<th>Type</th>
105+
<th>Description</th>
106+
<th>Default Value</th>
107+
<th>Required</th>
108+
</tr>
109+
</thead>
110+
<tbody>
111+
<tr>
112+
<td><strong>publication</strong></td>
113+
<td>
114+
<a href="" class="label type-hint type-hint-string">string</a>
115+
</td>
116+
<td><p> The name of the publication, as defined in the server side using `Meteor.publish`. </p>
117+
</td>
118+
<td></td>
119+
<td><a href="" class="label type-hint type-hint-object">Yes</a></td>
120+
</tr>
121+
<tr>
122+
<td>arguments...</td>
123+
<td>
124+
<a href="" class="label type-hint">Any</a>
125+
</td>
126+
<td><p> Argument that will be passed to the publication method. </p>
127+
</td>
128+
<td></td>
129+
<td><a href="" class="label type-hint type-hint-object">No</a></td>
130+
</tr>
131+
<tr>
132+
<td>resultCallback</td>
133+
<td>
134+
<a href="" class="label type-hint type-hint-object">object</a> /
135+
<a href="" class="label type-hint type-hint-function">function</a>
136+
</td>
137+
<td><p> May include `onStop` and `onReady` callbacks. If there is an error, it is passed as an argument to `onStop`. If a function is passed instead of an object, it is interpreted as an `onReady` callback. </p>
138+
</td>
139+
<td></td>
140+
<td><a href="" class="label type-hint type-hint-object">No</a></td>
141+
</tr>
142+
<tr>
143+
<td>autoBind</td>
144+
<td>
145+
<a href="" class="label type-hint type-hint-boolean">boolean</a>
146+
</td>
147+
<td><p> Boolean that specify if to bind the callback to the NgZone of the component. </p>
148+
</td>
149+
<td>false</td>
150+
<td><a href="" class="label type-hint type-hint-object">No</a></td>
151+
</tr>
152+
</tbody>
153+
</table>
154+
155+
### call
156+
157+
This method is a wrapper of [Meteor.call](http://docs.meteor.com/#/full/meteor_call).
158+
159+
This method invokes a method passing any number of arguments.
160+
161+
<table class="variables-matrix input-arguments">
162+
<thead>
163+
<tr>
164+
<th>Argument Name</th>
165+
<th>Type</th>
166+
<th>Description</th>
167+
<th>Default Value</th>
168+
<th>Required</th>
169+
</tr>
170+
</thead>
171+
<tbody>
172+
<tr>
173+
<td><strong>name</strong></td>
174+
<td>
175+
<a href="" class="label type-hint type-hint-string">string</a>
176+
</td>
177+
<td><p> The name of the Meteor method to run on the server side.</p>
178+
</td>
179+
<td></td>
180+
<td><a href="" class="label type-hint type-hint-object">Yes</a></td>
181+
</tr>
182+
<tr>
183+
<td>arguments...</td>
184+
<td>
185+
<a href="" class="label type-hint">Any</a>
186+
</td>
187+
<td><p> Argument that will be passed to the method. </p>
188+
</td>
189+
<td></td>
190+
<td><a href="" class="label type-hint type-hint-object">No</a></td>
191+
</tr>
192+
<tr>
193+
<td>resultCallback</td>
194+
<td>
195+
<a href="" class="label type-hint type-hint-function">function</a>
196+
</td>
197+
<td><p> Optional callback, which is called asynchronously with the error or result after the method is complete. If not provided, the method runs synchronously if possible (see below).
198+
</p>
199+
</td>
200+
<td></td>
201+
<td><a href="" class="label type-hint type-hint-object">No</a></td>
202+
</tr>
203+
</tbody>
204+
</table>
205+
12206

13207
{{/markdown}}
14208

docs/angular-meteor/client/stylesheets/content/api_tutorial/code_styles.import.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ code {
6262
background: #3a87ad;
6363
}
6464

65-
.type-hint-function {
65+
.type-hint-function, .type-hint-class {
6666
background: green;
6767
}
6868

0 commit comments

Comments
 (0)