I am working with JSON data and I want to display it filtered by genre. The solution provided in the previous question How to filter JSON-Data with AngularJs? did not work for me.
Here is myapp.js:
var myApp = angular.module('myApp', []);
myApp.controller('myApp', function($scope) {
$scope.isoffice = function(apps) {
return apps[0].genre === "office";
};
$scope.apps = [
{
"id": "stardict",
"genre": "aksesoris",
"name": "Stardict"
},
{
"id": "libreoffice",
"genre": "office",
"name": "LibreOffice"
}];
}
And here is my index.html:
<div ng-repeat="app in apps | filter:isoffice">
{{apps[0].name}}
</div>
Am I missing something? Any help would be appreciated. Thank you!