My issue lies in adding a filter to display categories, as my setCurrentCategory function is not showing any value but instead displaying 'undefined'. The goal is to show the category for each person. I'm using ng-click to pass to my function and then utilizing a filter to pass the value.
var myapp = angular.module("myapp", []);
myapp.controller("myCtrl", function($scope){
$scope.categories = [
{'id' : 0, 'Name' : 'Manu'},
{'id' : 1, 'Name' : 'Rajveer'},
{'id' : 2, 'Name' : 'Heament'},
{'id' : 3, 'Name' : 'Yogesh'},
{'id' : 5, 'Name' : 'Sajid'},
];
$scope.languages = [
{'id' : 0, 'title' : 'Angular', 'url' : 'http://angularjs.org', "category": "Manu"},
{'id' : 0, 'title' : 'Html5', 'url' : 'http://www.html5rocks.com/en/', "category": "Manu"},
// Additional language data...
];
$scope.currentCategory = null;
function setCurrentCategory(category) {
$scope.currentCategory = category;
}
function isCurrentCategory(category) {
return $scope.currentCategory !== null && category.name === $scope.currentCategory.name;
}
$scope.setCurrentCategory = setCurrentCategory;
$scope.isCurrentCategory = isCurrentCategory;
});
.left_box {background-color: #909090; padding: 0px;}
// More CSS styling here...
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>