I currently have a json file that has page title and content data.
Like so :
[
{
"title":"About",
"content":"About me . . . . . . "
},
{
"title":"Contact",
"content":"Reach me . . . ."
},
{
"title":"Create a Post",
"content": "What's on your mind?"
}
]
The json data is attached to an angular controller.
.controller('PageController', ['$scope', '$http', '$routeParams',function($scope,$http,$routeParams){
$http.get('../../../data/pages.json').success(function(data){
$scope.page = data[$routeParams.id];
});
}])
This information is attached to the dom view with angular js and ng-repeat.
I am looping ng-repeat="page in pages"
and so far I see the About, Contact, and Create Post page successfully. I can even click on the li tag and successfully transfer to the correct page.
However my problem is that the li tag never registers with an active class.
Here is my code snippet.
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav">
<li ng-class="{'active': 1}" ng-repeat="page in pages"><a href="#/page/{{pages.indexOf(page)}}">{{page.title}}</a></li>
</ul>
How can I set the li tag to active with this set up?