I have an api that I am calling like so:
app.controller('AppCtrl', function($scope, $http) {
$http({
method: 'GET',
url: 'http://localhost:4000/people',
headers: {
'Accept' : "application/json; charset=utf-8"
},
}).then(function successCallback(data) {
$scope.camps = data.data;
}, function errorCallback(data) {
console.log(data);
});
});
and I am doing an ng-repeat with a directive inside to loop through the data and output the variables:
<div ng-repeat="camp in camps track by $index | filter:search:strict">
<tile></tile>
</div>
I would like to be able to filter the <tile>, so I have an input that looks like this:
<md-input-container class="md-block">
<label>Person name</label>
<input ng-model="search.name">
</md-input-container>
Inside the tile directive I have a portion that looks like this:
<div class="variation-text col-md-8">
<h3 class="problem-header grey-header">{{ camp.name }}</h3>
</div>
and this is outputting the name endpoint from the api. How can I filter this name endpoint using the input field shown above?
When I currently run this application I get an error from Angular stating: Error: filter:notarray Not an array (url)..
What am I doing wrong for this to not work? I'd love some help. Thank you.
data.datawhen log it to console?