在 Angularjs 中 ui-sref 和 $state.go

ui-sref 一般使用在 <a>...</a>;

<a ui-sref="message-list">消息中心</a>

$state.go('someState')一般使用在起始页面controller里面;

.controller('firstCtrl', function($scope, $state) {
      $state.go('login');
 });

传参

$state.go('page2', {data: 'aaa'});

接收参数

目标页面的controller里注入$stateParams,然后 "$stateParams.参数名" 获取

posted @ 2016-07-20 19:12  Chris_在IT道路上前行  阅读(1317)  评论(0编辑  收藏  举报