午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

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

angular.js - angularjs標簽切換

瀏覽:253日期: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:

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

相關文章:
主站蜘蛛池模板: 日韩大胆人体 | 高清亚洲| www在线播放| 欧美高清视频一区 | 中文字幕在线播出 | www.免费黄色 | 99久久久国产精品 | 一起艹在线观看 | 成年人在线观看视频网站 | 中文字幕xxxx| 亚洲第一免费视频 | 久久青青操 | 九九综合 | 日韩射 | 91在线一区 | 国产又粗又猛又黄视频 | 色综合天天综合综合国产 | 毛片com | 91亚洲精品国偷拍自产在线观看 | 欧美人体视频 | 欧美日韩精品在线 | 四虎国产在线 | 四虎成人影视 | 久久这里只有精品6 | 国产999久久久 | 深爱五月网 | 中文字幕免费高清 | www久久久com| 精品热久久| 国产精品久久久久久久久久久久久久久久 | 国产特黄毛片 | 中文字幕精品一区 | 成人免费视频国产 | 亚洲丝袜av | 第一福利在线视频 | 9l蝌蚪porny中文自拍 | 91亚洲国产成人精品一区二区三 | h视频在线观看网站 | 欧美一区二区视频在线观看 | 国产欧美在线播放 | 美女久久视频 |