Skip to content

Commit fca7d94

Browse files
committed
Merge pull request #254 from JNissi/master
Added some documentation for AngularMeteorObject.getRawObject()
2 parents 769c2f4 + 7df57e8 commit fca7d94

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.docs/angular-meteor/client/views/api/api.AngularMeteorObject.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ <h3><p><code><span class="pln">reset();</span></code></p></h3>
6161

6262
Reset the current value of the object to the one in the server.
6363

64+
<br>
65+
<h3><p><code><span class="pln">getRawObject();</span></code></p></h3>
66+
67+
Returns a copy of the AngularMeteorObject with all the AngularMeteor-specific
68+
internal properties removed. The returned object is then safe to use as a parameter
69+
for <a href="/api/methods">method calls</a>, or anywhere else where the data needs
70+
to be converted to JSON.
6471

6572
----
6673

@@ -93,6 +100,19 @@ <h3><p><code><span class="pln">reset();</span></code></p></h3>
93100

94101
Parties.attachSchema(PartySchema);
95102

103+
Meteor.methods({
104+
doFancyStuff: function(party) {
105+
var id = party._id;
106+
// Do something fancy, like link with partygoers.
107+
108+
party.description = "Set to fancy description!";
109+
110+
delete party._id;
111+
112+
Parties.update({_id: id}, {$set: { party }});
113+
}
114+
});
115+
96116
if (Meteor.isClient) {
97117

98118
angular.module("socially").controller("PartyDetailsCtrl", ['$scope', '$stateParams', '$meteor',
@@ -121,6 +141,10 @@ <h3><p><code><span class="pln">reset();</span></code></p></h3>
121141
$scope.partyNotAuto.reset();
122142
};
123143

144+
// Call a method that does fancy stuff to the object.
145+
$scope.callMethod = function() {
146+
$meteor.call('doFancyStuff', $scope.party.getRawObject());
147+
};
124148
}]);
125149
}
126150

0 commit comments

Comments
 (0)