I dont get the search filter working.
projects template:
<h3>Projekte</h3>
Search: <input ng-model="searchText">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Long Title</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="(key, project) in projects | filter:searchText">
<td>{{key}}</td>
<td>{{project.title}}</td>
<td>{{project.longTitle}}</td>
<td><button class="btn btn-default" ng-click="edit()"><i class="fa fa-pencil"></i></button></td>
</tr>
</tbody>
</table>
controller:
var secProjects = function ($http,$scope, $modal) {
$http.post('php/data.php').
success(function(data) {
$scope.projects = data;
})
}
php:
while($row = mysql_fetch_object($result)){
$data[$row->ID] = array ('id'=>$row->ID,'title'=>$row->Title,'longTitle'=>$row->TitleLong, 'textDE'=>$row->DescriptionDE,'start'=>$row->DateStart,'end'=>$row->DateEnd);
}
echo json_encode($data);
i hope you can help me :( I think the reason ist the way i get the data in my scope. but iam not sure.
EDIT: Change the PHP solved the Problem:
$data = array();
while($row = mysql_fetch_object($result)){
array_push($data,['id'=>$row->ID,'title'=>$row->Title,'longTitle'=>$row->TitleLong]);
}
echo json_encode($data);