angularjs - Dynamically making side bar menu as active -
i having 1 master page has sidebar menu items , footer.i using sidebar in other pages.after login dashboard menu gets highlighted because making active.but after clicking on other links how can make menu active because using 1 sidebar common pages.is there way can dynamically? or have copy below code in every page , make particular menu item active?
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="leftmenu"> <ul> <a href="#!/admindashboardhome" title="dashboard"><li class="active"><span class="glyphicon glyphicon-th"></span> <span>dashboard</span></li></a> <a href="#!/examinationhalltickets" title="declaration"><li><span class="glyphicon glyphicon-barcode"></span><span>examination form</span></li></a> <a href="#!/collegedetails" title="declaration"><li><span class="glyphicon glyphicon-education"></span><span>college details</span></li></a> <a href="#!/studentdetails" title="declaration"> <li><span class="glyphicon glyphicon-user"></span><span>student details</span></li></a> </ul> </div> </div>
this should trick
html:
<a ng-class="getclass('/admindashboardhome')" href="/admindashboardhome">dashboard</a>
javascript:
$scope.getclass = function (path) { return ($location.path().substr(0, path.length) === path) ? 'active' : ''; }
css:
.active { //styling }
Comments
Post a Comment