路由是这么定义的:
$stateProvider
.state('page1', {
url: '/page1',
templateUrl: 'views/page1.htm',
controller: 'page1Ctrl'
})
.state('page2', {
url: '/page2/:type',
templateUrl: 'views/page2.htm',
controller: 'page2Ctrl'
});
用ng-href跳转的话,是这么写的:
ng-href="#/page1" rel="external nofollow"
ng-href="#/page2/1" rel="external nofollow"
用$state.go跳转的话,是这么写的:
$state.go("page1");
$state.go("page2",{type:1});
用ui-sref跳转的话,是这么写的:
ui-sref="page1"
ui-sref="page2({type:1})"
//跳转页面
$state.go('second', {
area: 'admin',
controller: 'mallmanage',
action:'detail'
});
更多: