goinstant/goangular

Query

Closed this issue · 1 comments

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?

Joining.