Skip to content

Commit

Permalink
(docs): Update docs and tutorial to the new 0.7.0 API
Browse files Browse the repository at this point in the history
  • Loading branch information
Urigo committed Feb 23, 2015
1 parent 46d4ba9 commit 3de011a
Show file tree
Hide file tree
Showing 28 changed files with 167 additions and 172 deletions.
10 changes: 5 additions & 5 deletions .docs/angular-meteor/client/views/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<div class="col-md-3">
<h2><a href="/api">API</a></h2>
<ul class="nav">
<li><a href="/api/meteorCollection">$meteorCollection</a></li>
<li><a href="/api/meteorCollection">$meteor.collection</a></li>
<li><a href="/api/AngularMeteorCollection">AngularMeteorCollection</a></li>
<li><a href="/api/subscribe">$meteorSubscribe.subscribe</a></li>
<li><a href="/api/methods">$meteorMethods.call</a></li>
<li><a href="/api/session">$meteorSession.bind</a></li>
<li><a href="/api/subscribe">$meteor.subscribe</a></li>
<li><a href="/api/methods">$meteor.call</a></li>
<li><a href="/api/session">$meteor.session.bind</a></li>
<li><a href="/api/user">User</a></li>
<li><a href="/api/meteorObject">$meteorObject</a></li>
<li><a href="/api/meteorObject">$meteor.object</a></li>
<li><a href="/api/getReactively">$scope.getReactively</a></li>
<li><a href="/api/meteor-include">meteor-include directive</a></li>
<li><a href="/api/utils">$meteorUtils</a></li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

## Usage

See [$meteorCollection](/api/meteorCollection)
See [$meteor.collection](/api/meteorCollection)

----

Expand Down Expand Up @@ -91,9 +91,9 @@ <h3><p><code><span class="pln">remove( :keys );</span></code></p></h3>
<h3><p><code><span class="pln">subscribe( :subscriptionName );</span></code></p></h3>
<br>

A shorten (Syntactic sugar) function for the <a href="/api/subscribe">$meteorSubscribe.subscribe function</a>.
A shorten (Syntactic sugar) function for the <a href="/api/subscribe">$meteor.subscribe function</a>.

Takes only one parameter and not returns a promise like <a href="/api/subscribe">$meteorSubscribe.subscribe</a> does.
Takes only one parameter and not returns a promise like <a href="/api/subscribe">$meteor.subscribe</a> does.

#### Parameters

Expand All @@ -112,7 +112,7 @@ <h3><p><code><span class="pln">subscribe( :subscriptionName );</span></code></p>
<td>
<a href="" class="label type-hint type-hint-string">subscriptionName</a>
</td>
<td><p>The subscription name to subscribe to. exactly like the first parameter in $meteorSubscribe service.
<td><p>The subscription name to subscribe to. exactly like the first parameter in $meteor.subscribe service.
</p></td>
<td><a href="" class="label type-hint type-hint-object">Yes</a></td>
</tr>
Expand All @@ -127,7 +127,7 @@ <h3><p><code><span class="pln">subscribe( :subscriptionName );</span></code></p>
## Example

// Bind all the todos to $scope.todos without auto-save
$scope.todos = $meteorCollection(Todos, false);
$scope.todos = $meteor.collection(Todos, false);

var todoObject = {name:'first todo'};
var todoArray = [{name:'second todo'}, {name:'third todo'}];
Expand All @@ -152,7 +152,7 @@ <h3><p><code><span class="pln">subscribe( :subscriptionName );</span></code></p>


// Using the subscribe function
$scope.parties = $meteorCollection(Parties).subscribe('partiesSubscription');
$scope.parties = $meteor.collection(Parties).subscribe('partiesSubscription');

{{/markdown}}
</do-nothing>
Expand Down
6 changes: 3 additions & 3 deletions .docs/angular-meteor/client/views/api/api.getReactively.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

$scope.sort = { name: 1 };

$scope.parties = $meteorCollection(function() {
$scope.parties = $meteor.collection(function() {
return Parties.find({}, {
sort : $scope.getReactively('sort') // Every time $scope.sort will change,
// the reactive function will re-run again
Expand All @@ -67,8 +67,8 @@

// Everytime one of the getReactively variables will change,
// the autorun will fire and the subscription will re-run
$meteorUtils.autorun($scope, function() {
$meteorSubscribe.subscribe('parties', {
$meteor.autorun($scope, function() {
$meteor.subscribe('parties', {
limit: parseInt($scope.getReactively('perPage')),
skip: (parseInt($scope.getReactively('page')) - 1) * parseInt($scope.getReactively('perPage')),
sort: $scope.getReactively('sort')
Expand Down
14 changes: 7 additions & 7 deletions .docs/angular-meteor/client/views/api/api.meteorCollection.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<do-nothing>
{{#markdown}}

# $meteorCollection
# $meteor.collection

A service that wraps the [Meteor collections](http://docs.meteor.com/#/full/collections) to enable reactivity within AngularJS.

----

## Usage

$meteorCollection(collection, auto)
$meteor.collection(collection, auto)

### Arguments

Expand Down Expand Up @@ -82,22 +82,22 @@

if (Meteor.isClient) {

app.controller("mainCtrl", ['$scope', '$meteorCollection',
function($scope, $meteorCollection){
app.controller("mainCtrl", ['$scope', '$meteor',
function($scope, $meteor){

// Bind all the todos to $scope.todos
$scope.todos = $meteorCollection(Todos);
$scope.todos = $meteor.collection(Todos);

$scope.sticky = true;
// Bind all sticky todos to $scope.stickyTodos
// Binds the query to $scope.sticky so that if it changes, Meteor will re-run the query and bind it
// to $scope.stickyTodos
$scope.stickyTodos = $meteorCollection(function(){
$scope.stickyTodos = $meteor.collection(function(){
return Todos.find({sticky: $scope.getReactively('sticky')});
});

// Bind without auto-save all todos to $scope.notAutoTodos
$scope.notAutoTodos = $meteorCollection(Todos, false).subscribe("publicTodos");
$scope.notAutoTodos = $meteor.collection(Todos, false).subscribe("publicTodos");

// todo might be an object like this {text: "Learn Angular", sticky: false}
// or an array like this:
Expand Down
12 changes: 6 additions & 6 deletions .docs/angular-meteor/client/views/api/api.meteorObject.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<do-nothing>
{{#markdown}}

# $meteorObject
# $meteor.object

A service that wraps a Meteor object to enable reactivity within AngularJS.

----

## Usage

$meteorObject(collection, id, auto)
$meteor.object(collection, id, auto)

### Arguments

Expand Down Expand Up @@ -87,12 +87,12 @@

if (Meteor.isClient) {

angular.module("socially").controller("PartyDetailsCtrl", ['$scope', '$stateParams', '$meteorObject',
function($scope, $stateParams, $meteorObject){
angular.module("socially").controller("PartyDetailsCtrl", ['$scope', '$stateParams', '$meteor',
function($scope, $stateParams, $meteor){

$scope.party = $meteorObject(Parties, $stateParams.partyId);
$scope.party = $meteor.object(Parties, $stateParams.partyId);

$scope.partyNotAuto = $meteorObject(Parties, $stateParams.partyId, false);
$scope.partyNotAuto = $meteor.object(Parties, $stateParams.partyId, false);

$scope.save = function() {
$scope.partyNotAuto.save().then(function(numberOfDocs){
Expand Down
6 changes: 3 additions & 3 deletions .docs/angular-meteor/client/views/api/api.methods.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<do-nothing>
{{#markdown}}

# $meteorMethods
# $meteor.call

A service service which wraps up [Meteor.methods](http://docs.meteor.com/#/full/methods_header) with [AngularJS promises](https://docs.angularjs.org/api/ng/service/$q).

----

## Usage

$meteorMethods.call(name, methodArguments)
$meteor.call(name, methodArguments)

### Arguments

Expand Down Expand Up @@ -63,7 +63,7 @@

$scope.invite = function(party, user){

$meteorMethods.call('invite', party._id, user._id).then(
$meteor.call('invite', party._id, user._id).then(
function(data){

// Handle success
Expand Down
10 changes: 5 additions & 5 deletions .docs/angular-meteor/client/views/api/api.session.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<do-nothing>
{{#markdown}}

# $meteorSession
# $meteor.session

A service that binds a scope variable to a Meteor Session variable.

----

## Usage

$meteorSession(sessionKey).bind(scope, model)
$meteor.session(sessionKey).bind(scope, model)

### Arguments

Expand Down Expand Up @@ -57,10 +57,10 @@

if (Meteor.isClient) {

app.controller("detailCtrl", ['$scope', '$meteorSession',
function($scope, $meteorSession){
app.controller("detailCtrl", ['$scope', '$meteor',
function($scope, $meteor){

$meteorSession('counter').bind($scope, 'counter');
$meteor.session('counter').bind($scope, 'counter');

Tracker.autorun(function () {
console.log('angular counter changed', Session.get('counter'));
Expand Down
12 changes: 6 additions & 6 deletions .docs/angular-meteor/client/views/api/api.subscribe.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<do-nothing>
{{#markdown}}

# $meteorSubscribe
# $meteor.subscribe

A service which is a wrapper for [Meteor.subscribe](http://docs.meteor.com/#/full/meteor_subscribe).
It subscribes to a [Meteor.publish](http://docs.meteor.com/#/full/publishandsubscribe) method in the client and returns a [AngularJS promise](https://docs.angularjs.org/api/ng/service/$q) when ready
Expand All @@ -17,7 +17,7 @@

## Usage

$meteorSubscribe.subscribe(name, publisherArguments)
$meteor.subscribe(name, publisherArguments)

### Arguments

Expand Down Expand Up @@ -67,12 +67,12 @@

if (Meteor.isClient) {

app.controller("mainCtrl", ['$scope', '$meteorCollection', '$meteorSubscribe',
function($scope, $meteorCollection, $meteorSubscribe){
app.controller("mainCtrl", ['$scope', '$meteor',
function($scope, $meteor){

$meteorSubscribe.subscribe('todos').then(function(subscriptionHandle){
$meteor.subscribe('todos').then(function(subscriptionHandle){
// Bind all the todos to $scope.todos
$scope.todos = $meteorCollection(Todos);
$scope.todos = $meteor.collection(Todos);

console.log($scope.todos + ' is ready');

Expand Down
2 changes: 1 addition & 1 deletion .docs/angular-meteor/client/views/api/api.user.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
$stateProvider
.state('home', {
url: '/',
templateUrl: 'client/views/home.tpl',
templateUrl: 'client/views/home.ng.html',
controller: 'HomeController'
resolve: {
currentUserNonReactive: $rootScope.currentUserPromise
Expand Down
4 changes: 3 additions & 1 deletion .docs/angular-meteor/client/views/api/api.utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

## Usage

$meteorUtils
$meteor.autorun( :scope, :function );

$meteor.getCollectionByName( :collectionName );

----

Expand Down
16 changes: 8 additions & 8 deletions .docs/angular-meteor/client/views/steps/tutorial.step_00.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ This package takes care of including the latest AngularJS library code into our

That's it! now we can use the AngularJS power in our Meteor app.

To start simple, create a new file called index.tpl under the main folder, this will be our main HTML template page.
To start simple, create a new file called index.ng.html under the main folder, this will be our main HTML template page.

* We are using the .tpl file extension so that Blaze - Meteor's templating system won't compile and override our AngularJS expressions.
* We are using the .ng.html file extension so that Blaze - Meteor's templating system won't compile and override our AngularJS expressions.

Then move the p tag into it:

__`index.tpl`:__
__`index.ng.html`:__

</btf-markdown>

Expand All @@ -131,7 +131,7 @@ __`index.html`:__

<pre><code>
<span class="hljs-tag">&lt;<span class="hljs-title">body</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">ng-include</span>=<span class="hljs-value">"'index.tpl'"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">ng-include</span>=<span class="hljs-value">"'index.ng.html'"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">body</span>&gt;</span>
</code></pre>

Expand Down Expand Up @@ -170,7 +170,7 @@ And name our application in the ng-app directive in index.html:
</btf-markdown>

<pre><code>
&lt;<span class="hljs-operator">div</span> ng-app=<span class="hljs-string">"socially"</span> ng-<span class="hljs-built_in">include</span>=<span class="hljs-string">"'index.tpl'"</span>&gt;&lt;/<span class="hljs-operator">div</span>&gt;
&lt;<span class="hljs-operator">div</span> ng-app=<span class="hljs-string">"socially"</span> ng-<span class="hljs-built_in">include</span>=<span class="hljs-string">"'index.ng.html'"</span>&gt;&lt;/<span class="hljs-operator">div</span>&gt;
</code></pre>
<btf-markdown>

Expand All @@ -181,7 +181,7 @@ Now run the app.

everything is the same.

and now inside our index.tpl let's use Angular:
and now inside our index.ng.html let's use Angular:

</btf-markdown>

Expand All @@ -206,7 +206,7 @@ Rather than a one-time insert, as we'll see in the next steps, a binding will re
Inside in the client side, like a future smart browser would do.


> Why did use a new file extension file.tpl ?
> Why did use a new file extension file.ng.html ?
>
> That is because Meteor templating system uses double-curlies. If we use them in our AngularJS view HTML, Meteor will override Angular.
>
Expand All @@ -217,7 +217,7 @@ Inside in the client side, like a future smart browser would do.


# Experiments
Try adding a new expression to the index.tpl that will do some math:
Try adding a new expression to the index.ng.html that will do some math:

</btf-markdown>

Expand Down
8 changes: 4 additions & 4 deletions .docs/angular-meteor/client/views/steps/tutorial.step_01.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ <h1>Step 1</h1>
In this step you will add some basic information about two parties to an HTML page.


Add this template HTML to index.tpl:
Add this template HTML to index.ng.html:

__`index.tpl`:__
__`index.ng.html`:__

<ul>
<li>
Expand All @@ -50,7 +50,7 @@ <h1>Step 1</h1>

# Experiments

Try adding more static HTML to index.tpl. For example:
Try adding more static HTML to index.ng.html , For example:

<p>Total number of parties: 2</p>

Expand All @@ -69,4 +69,4 @@ <h1>Step 1</h1>
<a href="/tutorial/step_02"><li class="btn btn-primary">Next <i class="glyphicon glyphicon-step-forward"></i></li></a>
</ul>
</div>
</template>
</template>
Loading

0 comments on commit 3de011a

Please sign in to comment.