Skip to content

Commit 5d0140d

Browse files
committed
Merge pull request #1225 from Urigo/feature/angular2-api-reference
Added Angular2-Meteor API Reference
2 parents 5b57631 + 01f480a commit 5d0140d

Some content is hidden

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

43 files changed

+449
-44
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
API_DEFINITION = {
1+
ANGULAR1_API_DEFINITION = {
22
'1.3.2': API_1_3_2('1.3.2', '1.3.1'),
33
'1.3.1': API_1_3_1('1.3.1'),
44
'1.3.0': API_1_3_0('1.3.0', '1.2.2'),
@@ -7,4 +7,4 @@ API_DEFINITION = {
77
'1.2.0': API_1_2_2('1.2.0', '1.2.2')
88
};
99

10-
DEFAULT_API = '1.3.2';
10+
ANGULAR1_DEFAULT_API = '1.3.2';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
ANGULAR2_API_0_4_2 = function(version, basedOnTemplatesOf) {
2+
var urlBase = '/api/angular2/' + version + '/';
3+
var templatePrefix = basedOnTemplatesOf || version;
4+
5+
return {
6+
groups: [
7+
{
8+
id: "0",
9+
title: "",
10+
route: "api",
11+
path: urlBase,
12+
redirectRoute: "/api/angular2/" + version + "/meteorComponent",
13+
template: "api",
14+
seoTitleSuffix: " | Angular2 Meteor API",
15+
seoDesc: "angular2-meteor is a realtime full stack that combines the best frameworks. use your existing Angular2.0 applications with Meteor - the best backend framework for AngularJS 2.0 applications.",
16+
pages: [
17+
{
18+
id: "01",
19+
route: "api.angular2." + version + ".meteorComponent",
20+
path: urlBase + "meteorComponent",
21+
title: "MeteorComponent",
22+
seoTitle: "MeteorComponent",
23+
mdContent: "api.angular2." + templatePrefix + ".meteorComponent"
24+
},
25+
{
26+
id: "02",
27+
route: "api.angular2." + version + ".bootstrap",
28+
path: urlBase + "bootstrap",
29+
title: "bootstrap",
30+
seoTitle: "bootstrap",
31+
mdContent: "api.angular2." + templatePrefix + ".bootstrap"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ANGULAR2_API_DEFINITION = {
2+
'0.4.2': ANGULAR2_API_0_4_2('0.4.2')
3+
};
4+
5+
ANGULAR2_DEFAULT_API = '0.4.2';

docs/angular-meteor/both/router/router.js

+29-22
Original file line numberDiff line numberDiff line change
@@ -161,32 +161,39 @@ Router.map(function () {
161161
});
162162

163163
var directedRouteNames = [];
164-
for (var apiKey in API_DEFINITION) {
165-
var currentApi = API_DEFINITION[apiKey];
166-
167-
for (var coreAPI in currentApi.groups[0].pages) {
168-
var routeName = currentApi.groups[0].pages[coreAPI].route;
169-
routeName = routeName.slice(routeName.lastIndexOf('.') + 1);
170-
var redirectFrom = '/api/' + routeName;
171-
var redirectTo = '/api/' + apiKey + '/' + routeName;
172-
if (!_.contains(directedRouteNames, routeName)) {
173-
redirect(redirectFrom, redirectTo);
174-
directedRouteNames.push(routeName);
164+
165+
var createApiRoutes = function(apisDefs, appendToLinks){
166+
for (var apiKey in apisDefs) {
167+
var currentApi = apisDefs[apiKey];
168+
169+
for (var coreAPI in currentApi.groups[0].pages) {
170+
var routeName = currentApi.groups[0].pages[coreAPI].route;
171+
routeName = routeName.slice(routeName.lastIndexOf('.') + 1);
172+
var redirectFrom = '/api/' + appendToLinks + routeName;
173+
var redirectTo = '/api/' + appendToLinks + apiKey + '/' + routeName;
174+
if (!_.contains(directedRouteNames, routeName)) {
175+
redirect(redirectFrom, redirectTo);
176+
directedRouteNames.push(routeName);
177+
}
175178
}
176-
}
177179

178-
createSubRoutes(currentApi);
180+
createSubRoutes(currentApi);
179181

180-
(function (routeUrl) {
181-
if (routeUrl) {
182-
Router.route('/api/' + apiKey, function () {
183-
this.redirect(routeUrl);
184-
});
185-
}
186-
})(currentApi.groups[0].redirectRoute);
187-
}
182+
(function (routeUrl) {
183+
if (routeUrl) {
184+
Router.route('/api/' + appendToLinks + apiKey, function () {
185+
this.redirect(routeUrl);
186+
});
187+
}
188+
})(currentApi.groups[0].redirectRoute);
189+
}
190+
};
191+
192+
createApiRoutes(ANGULAR1_API_DEFINITION, '');
193+
createApiRoutes(ANGULAR2_API_DEFINITION, 'angular2');
188194

189-
redirect('/api', '/api/' + DEFAULT_API + '/helpers');
195+
redirect('/api', '/api/' + ANGULAR1_DEFAULT_API + '/helpers');
196+
redirect('/api/angular2', '/api/angular2/' + ANGULAR2_DEFAULT_API + '/meteorComponent');
190197

191198
// -------------------------------------------------------------------------
192199
// Migration routes

docs/angular-meteor/both/router/subroutes/tutorial-pages.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ PAGES = [
1010
seoTitlePrefix: "Angular Meteor Tutorial | ",
1111
subHead: "Build your first Angular Meteor app",
1212
stepbarHide: true,
13-
pages: SOCIALLY_ANGULAR1
13+
pages: SOCIALLY_ANGULAR1,
14+
apiPath: '/api/'
1415
},
1516
{
1617
id: "2",
@@ -23,7 +24,8 @@ PAGES = [
2324
seoTitlePrefix: "Angular 2.0 Meteor Tutorial | ",
2425
subHead: "Angular 2.0 Meteor tutorial",
2526
stepbarHide: true,
26-
pages: SOCIALLY_ANGULAR2
27+
pages: SOCIALLY_ANGULAR2,
28+
apiPath: '/api/angular2/'
2729
},
2830
{
2931
id: "3",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<template name="api.angular2.0.4.2.bootstrap">
2+
<div>
3+
<a href="https://github.com/Urigo/angular-meteor/edit/master/docs/angular-meteor/client/content/api-reference/angular2-meteor/0.4.2/api.bootstrap.html"
4+
class="btn btn-default btn-lg improve-button">
5+
<i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this doc
6+
</a>
7+
8+
<do-nothing>
9+
{{#markdown}}
10+
11+
# bootstrap
12+
13+
`bootstrap` method provides the basic application bootstrap process, it also adds support for iterating `Mongo.Cursor` object withing `ngFor`.
14+
15+
This is a wrapper for Angular2 `bootstrap`, which documented [here](https://angular.io/docs/ts/latest/api/platform/browser/bootstrap-function.html).
16+
17+
#### Usage Example
18+
19+
When working with TypeScript, import `bootstrap` method from `angular2-meteor` package, as follow:
20+
21+
import {bootstrap} from 'angular2-meteor';
22+
23+
And use it with your main application class,
24+
25+
@Component({
26+
selector: 'app'
27+
})
28+
@View({
29+
template: 'Hello World!'
30+
})
31+
class App {
32+
33+
}
34+
35+
bootstrap(App);
36+
37+
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>
74+
75+
{{/markdown}}
76+
77+
</do-nothing>
78+
79+
</div>
80+
</template>

0 commit comments

Comments
 (0)