diff --git a/.docs/angular-meteor/client/views/api/api.meteorObject.html b/.docs/angular-meteor/client/views/api/api.meteorObject.html
index 62ed25e50..51c742130 100644
--- a/.docs/angular-meteor/client/views/api/api.meteorObject.html
+++ b/.docs/angular-meteor/client/views/api/api.meteorObject.html
@@ -14,8 +14,7 @@
Finds the first document that matches the selector, as ordered by sort and skip options.
Wraps [collection.findOne](http://docs.meteor.com/#/full/findone)
-Calling $scope.$meteorObject is exactly the same but additionally it will automatically stop the object when the scope is destroyed.
-Therefor this is the recommended method.
+Calling $scope.$meteorObject is exactly the same but additionally it will automatically stop the object when the scope is destroyed; therefore this is the recommended method.
----
@@ -25,6 +24,12 @@
$scope.$meteorObject(collection, selector, auto)
+ If you documents are saved with objects IDs (and not strings: see here ),
+you should use new Mongo.objectID
to retieve the object.
+
+ $meteor.object (collection, new Meteor.ObjectID (stringId), auto);
+
+
### Arguments
@@ -104,6 +109,7 @@
$scope.party = $meteor.object(Parties, $stateParams.partyId);
+
$scope.partyNotAuto = $scope.$meteorObject(Parties, $stateParams.partyId, false);
$scope.save = function() {
@@ -129,3 +135,6 @@
+
+
+
diff --git a/modules/angular-meteor-object.js b/modules/angular-meteor-object.js
index 645d63ccf..4b9b1fd83 100644
--- a/modules/angular-meteor-object.js
+++ b/modules/angular-meteor-object.js
@@ -82,7 +82,8 @@ angularMeteorObject.factory('AngularMeteorObject', ['$q', '$meteorSubscribe', fu
// A list of internals properties to not watch for, nor pass to the Document on update and etc.
AngularMeteorObject.$$internalProps = [
- 'save', 'reset', '$$collection', '$$options', '$$id', '$$hashkey', '$$internalProps', 'subscribe', 'stop', 'autorunComputation', 'unregisterAutoBind', 'unregisterAutoDestroy', 'getRawObject'
+ 'save', 'reset', '$$collection', '$$options', '$$id', '$$hashkey', '$$internalProps', 'subscribe', 'stop', 'autorunComputation', 'unregisterAutoBind', 'unregisterAutoDestroy', 'getRawObject',
+ 'collection', '_eventEmitter'
];
var createAngularMeteorObject = function(collection, id, options){
@@ -108,9 +109,13 @@ angularMeteorObject.factory('$meteorObject', ['$rootScope', '$meteorUtils', 'Ang
function($rootScope, $meteorUtils, AngularMeteorObject) {
return function(collection, id, auto, options) {
// Validate parameters
- if (!(collection instanceof Meteor.Collection)) {
- throw new TypeError("The first argument of $collection must be a Meteor.Collection object.");
+ if (!collection) {
+ throw new TypeError("The first argument of $meteorCollection is undefined.");
}
+ if (!angular.isFunction(collection.findOne)) {
+ throw new TypeError("The first argument of $meteorCollection must be a function or a have a findOne function property.");
+ }
+
auto = auto !== false; // Making auto default true - http://stackoverflow.com/a/15464208/1426570
var data = new AngularMeteorObject(collection, id, options);