$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>
默认如下图:
点账号设置的时候 我希望当前状态在账号设置上 但是效果确是下面这样子的
路过的帮我看看是什么问题呗,先谢过啦~~~
推荐你使用
angular
的ui-router
,很方便,而且更能十分强大;我看看有没有时间,帮你写个小demo。补充:
抽空帮你写的一个demo
HTML文件代码如下:
JS文件代码如下:
CSS文件代码如下:
希望可以帮到你。
雷雷
楼主 ,能不能将你的完整的例子贴出来啊,小弟需要学习一下