亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術文章
文章詳情頁

angular.js - angularjs標簽切換

瀏覽:148日期:2024-10-11 10:48:34

問題描述

$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- ng-controller='PersonController'> <a ng-click='go(’peopleProfile’, ’peopleprofile’)'><i class='fa fa-cog'></i>個人設置</a></p><p ng- ng-controller='PersonController'> <a ng-click='go(’peopleSettings’, ’peoplesettings’)'><i class='fa fa-cog'></i>賬號設置</a></p>

默認如下圖: angular.js - angularjs標簽切換

點賬號設置的時候 我希望當前狀態在賬號設置上 但是效果確是下面這樣子的angular.js - angularjs標簽切換

路過的幫我看看是什么問題唄,先謝過啦~~~

問題解答

回答1:

推薦你使用angular的ui-router,很方便,而且更能十分強大;我看看有沒有時間,幫你寫個小demo。

補充:

抽空幫你寫的一個demo

HTML文件代碼如下:

<body ng-app='MyApp' ng-controller='MyController as vm'> <h1>A demo of ui-router</h1> <ul class='menu'><li class='item'> <a ui-sref='personal-setting' ui-sref-active='item-active'>個人設置</a></li><li class='item'> <a ui-sref='account-setting' ui-sref-active='item-active'>賬號設置</a></li><li class='item'> <a ui-sref='hello-setting' ui-sref-active='item-active'>隨便看看</a></li> </ul> <hr/> <p ui-view>初始化狀態...</p></body>

JS文件代碼如下:

(function(){ angular.module(’MyApp’, [’ui.router’,’ngAnimate’ ]).config(config).controller(’MyController’, MyController); config.$inject = [’$stateProvider’, ’$urlRouterProvider’]; MyController.$inject = []; function config($stateProvider, $urlRouterProvider){$urlRouterProvider.otherwise(’setting/default’);$stateProvider .state(’account-setting’, {url: ’setting/account’,templateUrl: ’template/account-setting.html’ }) .state(’personal-setting’, {url: ’setting/personal’,templateUrl: ’template/personal-setting.html’ }) .state(’hello-setting’, {url: ’setting/hello’,templateUrl: ’template/hello-setting.html’ }) .state(’default-setting’, {url: ’setting/default’,templateUrl: ’template/default-setting.html’ }) } function MyController(){var vm = this; }})();

CSS文件代碼如下:

h1{ text-align: center;}.menu{ list-style: none;}.menu .item{ display: block; width: 80px; height: 30px; margin-top: 2px;}.menu .item a{ display: block; width: 80px; height: 30px; background-color: black; color: red; text-decoration: none; text-align: center; line-height: 30px;}.item-active{ background-color: red !important; color: black !important;}

希望可以幫到你。

回答2:

<p ng-controller='PersonController'> <p ng-class='peopleprofile ? ’peoplesetting-nav-style’ : ’peoplesetting-nav’'><a ng-click='go(’peopleProfile’, ’peopleprofile’)'> <i class='fa fa-cog'></i>個人設置</a> </p> <p ng-class='peoplesettings ? ’peoplesetting-nav-style’ : ’peoplesetting-nav’'><a ng-click='go(’peopleSettings’, ’peoplesettings’)'> <i class='fa fa-cog'></i>賬號設置</a> </p></p>回答3:

樓主 ,能不能將你的完整的例子貼出來啊,小弟需要學習一下

相關文章:
主站蜘蛛池模板: 在线观看免费黄网站 | 免费在线观看的黄色网址 | 自拍欧美日韩 | 精品久久久久久久 | 特黄aaaaaaaaa真人毛片 | 毛片xxxx | 国内精品久久久久久久999下 | 精品国产自在久久 | 欧美亚洲国产日韩一区二区三区 | 国产精品vv在线 | 亚洲精品网站在线观看不卡无广告 | 久99视频 | 男女草 | 日韩成人在线播放 | 免费观看情趣v视频网站 | 国产黄色视屏 | 久久久久久a亚洲欧洲aⅴ | 一区二区免费视频 | 免费看黄色片视频 | 国产在线h视频 | 欧美一级永久免费毛片在线 | 在线观看国产wwwa级羞羞视频 | 亚洲视频在线免费播放 | 日韩精品欧美在线 | 国产片性视频免费播放 | v视界成人影院在线视频 | 91一区二区三区四区五区 | 最新国产精品视频 | 国产老湿机福利视频在线观看 | 本道久久| 最新国产精品亚洲 | 一级做a毛片免费视频 | 免费看日日麻批免费视频播放 | 奇米色88欧美一区二区 | 97青青青国产在线播放 | 久久久久久99精品 | 国产精品片 | xxⅹ丰满妇女与善交 | 国产精品亚洲精品日韩己满十八小 | 一区二区高清视频在线观看 | 国产高清视频在线免费观看 |