When angularjs uses routing to jump to a certain view, how can I execute js to modify a navigation menu item to be active? The following is my current code
<script type="text/javascript"> var mainapp = angular.module('mainapp', ['ngRoute']); mainapp.config(function(${routeProvider}) { ${routeProvider} .when('/', { templateUrl: 'marry.php?cid=123&view=home', controller : 'mainController' }) .when('/home', { templateUrl: 'marry.php?cid=123&view=home', controller : 'mainController' }) .when('/process', { templateUrl: 'marry.php?cid=123&view=process', controller : 'mainController' }) .when('/message', { templateUrl: 'marry.php?cid=123&view=message', controller : 'mainController' }); }); mainapp.controller('mainController', function(${scope}) { ${scope}.message = 'Everyone come and see how good I look!'; }); </script>
Approximate code:
If you want to see some examples and documents, they are also available on my github
Learning resources: https://github.com/dolymood/AngularLearing
Simple example: https://github.com/dolymood/angular-example
Download packages and documentation https://github.com/dolymood/angular-packages
Place the activation effect on each menu item in advance, but do not display it;
Then pass the specific value to the front page to display the specific activation status;
For example
You just need to pass the corresponding tab value in the controller
Or use this method
Control the value true/false of isActive in angular controller
Hello, I am not very familiar with angularjs. Our project only uses the routing function of angularjs. The above is my code. Can you help me directly modify it based on the above code?