I'm trying to learn angular with firebase. I'm getting data and successfully output it. But after this, simple filters not working with this data. When i'm doing simple $http.get from the same, but local json file, filters works just fine. My application module/controller code:
var app = angular.module('testSite', ['ngRoute', 'angControllers', 'firebase'])
.value('fbURL', 'https://sizzling-fire-3696.firebaseio.com/')
.factory('personData', function($firebase, fbURL) {
return $firebase(new Firebase(fbURL));
});
app.controller("angCont", ['$scope', '$http', '$routeParams',
'personData',
function($scope, $http, $routeParams, personData) {
$scope.data = personData;
}]);
And this is my html template:
<div ng-controller="angCont">
<select ng-model="personSelectFilter" ng-options="person.name for person in data">
<option value="">Filter by name</option>
</select>
<input type="text" ng-model="personInputFilter" placeholder="Filter">
<ul>
<li ng-repeat="person in data | filter: personInputFilter |
filter: personSelectFilter | orderBy: personSorting">
Name: <a href="#/persons/{{person.name}}">{{person.name}}</a><br/>
Surname: {{person.surname}}<br/>
Age: {{person.age | number}}<br/>
Experience (months): {{person.exp | number}}</li>
</ul>
</div>