Click here to Skip to main content
14,692,047 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
am making menu and submenu dynamically from db and binding these with angularjs-ng-repeat but when i click on a menu-link or sub-menu link its making active to all sub-menu link....i am using this angularjs function

$scope.isActive = function (viewLocation) {
       var cur_path = $location.url().substr(1, viewLocation.length);
       var active = (cur_path === $location.url());
       return active;

and in html like

 <li style="color:#ffffff;" ng-class="{ active: isActive(submenu.NavigationURL) }" ng-repeat="submenu in menu.SubMenu">
<a href="{{submenu.NavigationURL}}">{{submenu.Name}}</a></li>

so pls tell me where i am doing wrong and how to make active current menu and sub-menu using angular with css or with any
Sreekanth Mothukuru 23-Jun-15 3:32am
I think you need to do ng-repeat="submenu in menu.SubMenu" on ul or ol instead on li tag. Why because ng-class may not get "submenu.NavigationURL" value.
Try and let us know.
Miss Maheshwari 23-Jun-15 4:45am
yes i did from ol and ul but no use
Sreekanth Mothukuru 23-Jun-15 10:15am
Show the code what you tried... like modifying ol and ul

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900