angular.module('app').config(['$stateProvider','$urlRouterProvider',function($stateProvider,$urlRouterProvider){ //$stateProvider路由模块,配置状态,可以放入多个.state //state(路由id,{路径,路由的url,业务逻辑}) $stateProvider.state('main',{ url:'/main', templateUrl:'view/main.html', controller:'mainCtrl' }).state('my',{ url:'/my', templateUrl:'view/my.html', controller:'myCtrl' }); //默认路径,如果都没有匹配到就转到main上面 $urlRouterProvider.otherwise('main'); }])
ui-sref-active="red"只要被选中才会有 ui-sref="{{item.url}}"实现跳转
<div class="foot"> <ul class=" footUl"> <!-- ng-repeat="item in footList" --> <li ui-sref-active="red" ui-sref="{{item.url}}" ng-repeat="item in footList" class="footLi {{red}}" > <i class="fa fa-lg footfa {{item.class}} "></i> <div class="footName " ng-bind="item.name"></div> </li> </ul> </div>