I’m trying to create an ng-repeat using getReactively as a filter for, in this case, cities.
Here’s the controller:
'use strict'
angular.module('myApp')
.controller('SpiderCtrl', function ($scope, $reactive, $stateParams, $mdDialog, $mdMedia) {
$reactive(this).attach($scope);
this.ciudad = '';
this.subscribe('spider', () => {
return [Spider.find({city: this.getReactively('ciudad')})];
});
this.changeCity = function (ciudad) {
this.ciudad = ciudad;
console.log(this.ciudad);
}
});
and here’s the view:
<div ng-repeat="spider in sc.spider">
<h1>{{spider.name}}</h1>
</div>
When I press the button to execute the changeCity
function, the console.logs normally but I get no results in my view.
this is my button:
<button ng-click="sc.changeCity('canovanas')">Filter</button>
How am I able to filter the ng-repeat via this method?
Thanks!