I get some data in JSON format that have spaces in some of the keys:
[ { "PlainKey": "SomeValue", "Spaced Key": "SomeValue" }, { "PlainKey": "SomeValue2", "Spaced Key": "SomeValue2" } ]
This happens at some point:
$http.get('https://dl.dropboxusercontent.com/u/80497/htmlTesting/properties/credits.properties' + '?callback=JSON_CALLBACK').then(function (data) { $scope.credits = data.data; }, function (error) { $scope.errorOccured = true; console.log("Error:"); console.log(error); });
and then ng-repeat used to display it in order:
<select ng-model="corder"> <option value="PlainKey">Plain Key</option> <option value="Spaced Key">Spaced Key</option> </select> <li ng-repeat="credit in credits | orderBy:corder" > ..... </li>
This does not work (I get an exception) ( PlainKey works because there are no spaces).
I also tried putting the values ββin ' :
<select ng-model="corder"> <option value="'PlainKey'">Plain Key</option> <option value="'Spaced Key'">Spaced Key</option> </select>
This is similar to reordering, but not correct.
What am I missing?
Thanks!
angularjs angularjs-ng-repeat angularjs-orderby
Ben
source share