Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 0b81003

Browse files
committed
Rename methods to omit use of '$' (reserved for angular by convention)
1 parent d6cbc19 commit 0b81003

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ You can bind specific functions if you wish to add, remove or update objects in
118118
the collection with any Angular directive:
119119

120120
```html
121-
<form ng-submit="items.$add(item)">
121+
<form ng-submit="items.add(item)">
122122
<input type="text" ng-model="item.name" placeholder="Name" required/>
123123
<input type="text" ng-model="item.desc" placeholder="Description"/>
124124
</form>
125125
```
126126

127-
You can do the same with the `$remove` and `$update` methods.
127+
You can do the same with the `remove` and `update` methods.
128128

129129
See the source for the
130130
[controller behind the demo chat app](https://github.com/firebase/angularFire/blob/gh-pages/examples/chat/app.js)

angularFire.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ angular.module('firebase').factory('angularFireCollection', function($timeout) {
170170
});
171171
});
172172

173-
collection.$add = function(item, cb) {
173+
collection.add = function(item, cb) {
174174
collectionRef.push(item, cb ? cb : null);
175175
};
176-
collection.$remove = function(itemOrId) {
176+
collection.remove = function(itemOrId) {
177177
var item = angular.isString(itemOrId) ? collection[itemOrId] : itemOrId;
178178
item.$ref.remove();
179179
};
180180

181-
collection.$update = function(itemOrId) {
181+
collection.update = function(itemOrId) {
182182
var item = angular.isString(itemOrId) ? collection[itemOrId] : itemOrId;
183183
var copy = {};
184184
angular.forEach(item, function(value, key) {

examples/chat/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ controller('Chat', ['$scope', '$timeout', 'angularFireCollection',
99
});
1010
$scope.username = 'Guest' + Math.floor(Math.random()*101);
1111
$scope.addMessage = function() {
12-
$scope.messages.$add({from: $scope.username, content: $scope.message}, function() {
12+
$scope.messages.add({from: $scope.username, content: $scope.message}, function() {
1313
el.scrollTop = el.scrollHeight;
1414
});
1515
$scope.message = "";

0 commit comments

Comments
 (0)