我是靠谱客的博主 激动刺猬,这篇文章主要介绍老生常谈angularjs中的$state.go,现在分享给大家,希望可以做个参考。

路由是这么定义的:

$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})"

可以对照一下

以上这篇老生常谈angularjs中的$state.go就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

最后

以上就是激动刺猬最近收集整理的关于老生常谈angularjs中的$state.go的全部内容,更多相关老生常谈angularjs中内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(251)

评论列表共有 0 条评论

立即
投稿
返回
顶部