goinstant / goangular

AngularJS bindings for GoInstant. Build realtime, multi-user apps with AngularJS and GoInstant easily. https://developers.goinstant.com/v1/GoAngular/index.html
BSD 3-Clause "New" or "Revised" License
136 stars 30 forks source link

Query #48

Closed mattcreager closed 10 years ago

mattcreager commented 10 years ago

I think we basically have two API front-runners

Add a $query method to $goKey:

angular.module('ChatApp').controller('ChatCtrl', ['$scope', '$goKey', function($scope, $key) {
  $scope.chat = $key('messages');
  $scope.chat.$query(filter, options);
  $scope.chat.$sync();
}]);

Create a new service dedicated to $query:

angular.module('ChatApp').controller('ChatCtrl', ['$scope', '$goQuery', function($scope, $query) {
  var filter = { “sender”: { “$eq”: “GrandMasterLivingston” }};
  var sort = { “$name”: “desc”};
  var limit = 20;
  var options = { sort: sort, limit: limit };

  $scope.chat = $query('messages', filter, options);
  $scope.chat.$sync();
}]);

Alternatively, we could have $goKey(keyName).$query(filter, options); be an alias for the long-form?

mattcreager commented 10 years ago

Joining.