File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
.docs/angular-meteor/client/views Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1111# $meteor.object
1212
1313A service that wraps a Meteor object to enable reactivity within AngularJS.
14+ Finds the first document that matches the selector, as ordered by sort and skip options.
15+ Wraps [collection.findOne](http://docs.meteor.com/#/full/findone)
1416
1517----
1618
1719## Usage
1820
19- $meteor.object(collection, id , auto)
21+ $meteor.object(collection, selector , auto)
2022
2123### Arguments
2224
4345 < td > </ td >
4446</ tr >
4547< tr >
46- < td > id</ td >
47- < td > < a href ="" class ="label type-hint type-hint-string "> string</ a > </ td >
48- < td > < p > The Id of the object to bind to</ p > </ td >
48+ < td > selector</ td >
49+ < td > < a href ="" class ="label type-hint type-hint-string "> Mongo Selector, Object ID, or String</ a > </ td >
50+ < td > < p > A query describing the documents to find or just the ID of the document.
51+ $meteor.object will find the first document that matches the selector,
52+ as ordered by sort and skip options, exactly like Meteor's < a href ="http://docs.meteor.com/#/full/findone "> collection.findOne</ a >
53+ </ p > </ td >
4954 < td > < a href ="" class ="label type-hint type-hint-array "> Yes</ a > </ td >
5055 < td > </ td >
5156</ tr >
106111 $scope.partyNotAuto.reset();
107112 };
108113
114+ // Query selector example
115+ $scope.partyOfUser = $meteor.object(Parties, {userId: Meteor.userId()});
116+
109117 }]);
110118 }
111119
Original file line number Diff line number Diff line change @@ -43,6 +43,15 @@ <h1>Step 6 - Bind one object</h1>
4343
4444$meteor.object returns an [AngularMeteorObject](/api/meteorObject) that contains the data.
4545
46+ $meteor.object accepts a selector as the second argument.
47+
48+ That selector can be Mongo Selector, Object ID, or String.
49+
50+ In our example we used the Object's ID but it can also come in the form of {field: query}.
51+
52+ $meteor.object will find the first document that matches the selector,
53+ as ordered by sort and skip options, exactly like Meteor's [collection.findOne](http://docs.meteor.com/#/full/findone)
54+
4655
4756# Template
4857
You can’t perform that action at this time.
0 commit comments