Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ $scope.objects.update(object);

If you would only like to fetch objects with a certain condition, use `where`.
``` javascript
$scope.objects = pang.Collection(ParseTable).where({'isAwesome', true}).build();
$scope.objects = pang.Collection(ParseTable).where('isAwesome', true).build();
```

To fetch objects if they exist, use `exist`.
``` javascript
$scope.objects = pang.Collection(ParseTable).exists('hasAwesomePower', true).build();
```

Sort the objects with `order`.
Expand Down
57 changes: 0 additions & 57 deletions app.js

This file was deleted.

61 changes: 0 additions & 61 deletions index.html

This file was deleted.

26 changes: 26 additions & 0 deletions pang.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,19 @@ angular.module('pang', []).factory('pang', function($rootScope) {
} // pangCollection.where()


/***************************************************************
*
* pangCollection.exists()
*
* Add the attributes to the list of matchs to add to the query.
*
***************************************************************/
pangCollection.exists = function(key, existence) {
pangCollection.exists[key] = existence != null ? existence : true;
return pangCollection;
} // pangCollection.exists()


/***************************************************************
*
* pangCollection.order()
Expand Down Expand Up @@ -477,6 +490,19 @@ angular.module('pang', []).factory('pang', function($rootScope) {
query.equalTo(match, pangCollection.queryMatches[match]);
}

//add all the needed existences to the query
for(key in pangCollection.exists) {

//ascending
if(pangCollection.exists[key] == true) {
query.exists(key);

//descending
} else {
query.doesNotExist(key);
}
}

//add sorting to the query which has been specified by the user with 'order'
for(key in pangCollection.orders) {

Expand Down