In html
<div ng-controller="homeCtrl as home">
<a class="list-group-item" ng-repeat="e in home.events | orderBy:'popularity'"> {{ e.name }}</a>
</div>
In the controller
var vm = this;
vm.events = [{
"name": "one",
"popularity": 1
}, {
"name": "four",
"popularity": 4
}, {
"name": "two",
"popularity": 2
}];
I get this error https://docs.angularjs.org/error/orderBy/notarray?p0=%7B%7D
My problem was that I had
before the function was called and I corrected it to
and it fixed it.
Thanks for the answers. Sorry my question didnt quite have all my code :/