$scope.peopleprofile = true;
$scope.peoplesettings = false;
if( $scope.locationpath == '/peopleProfile'){
$scope.peopleprofile = true;
$scope.peoplesettings = false;
}else if( $scope.locationpath == '/peopleSettings'){
$scope.peoplesettings = true;
$scope.peopleprofile = false;
}
$scope.go = function(url, type){
if( type == 'peopleprofile'){
$scope.peopleprofile = true;
$scope.peoplesettings = false;
}else if( type == 'peoplesettings'){
$scope.peoplesettings = true;
$scope.peopleprofile = false;
}
routeSrvc.go(url);
};
<p ng-class="{true: 'menu-item peoplesetting-nav-style', false: 'menu-item peoplesetting-nav'}[peopleprofile]" ng-controller="PersonController">
<a class="peoplesetting-title-style" ng-click="go('peopleProfile', 'peopleprofile')"><i class="fa fa-cog"></i>个人设置</a>
</p>
<p ng-class="{true: 'menu-item peoplesetting-nav-style', false: 'menu-item peoplesetting-nav'}[peoplesettings]" ng-controller="PersonController">
<a class="peoplesetting-title-style" ng-click="go('peopleSettings', 'peoplesettings')"><i class="fa fa-cog"></i>账号设置</a>
</p>
The default is as shown below:
When I click on the account settings, I hope that the current status is in the account settings, but the effect is indeed as follows
Anyone passing by can help me find out what the problem is. Thanks in advance~~~
Recommend you to use it
angular
的ui-router
, it is very convenient and very powerful; I will see if I have time and write a small demo for you.Added:
I took the time to write a demo for you
HTML file code is as follows:
The JS file code is as follows:
The CSS file code is as follows:
Hope this helps.
Owner, can you post your complete example? I need to learn from it