Last active
August 29, 2015 14:00
-
-
Save colinmacdonald/11261078 to your computer and use it in GitHub Desktop.
Basic usage of $goQuery to order items by $$index with the keyFilter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = angular.module('app', ['goangular']); | |
app.config(function($goConnectionProvider) { | |
var url = window.connectUrl || 'https://goinstant.net/account/app'; | |
$goConnectionProvider.$set(url); | |
}); | |
app.controller('queryCtrl', function($scope, $goQuery) { | |
$scope.data = $goQuery('myData', { sort: { '$name': 'desc'} }).$sync(); | |
$scope.add = function() { | |
$scope.data.$add({ text: 'item' }); | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body ng-app="app"> | |
<div ng-controller="queryCtrl"> | |
<button ng-click="add()">Add</button> | |
<ul> | |
<li ng-repeat="item in data | keyFilter">{{item.text}} - {{item.$name}}</li> | |
</ul> | |
</div> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment