Angular JS 传递参数的几种方法

1、利用$state.go(")

2、把参数放在rootscope 中缓存

 

3、利用 ui-sref="activity.detail({id: item['id']})" 

路由配置:

 .state('activity.detail', {
                url: '/detail/:id',
                views: {
                    'content@activity': {
                        templateUrl: 'template/activity/detail.html',
                        controller: 'ActivityDetailController',
                        controllerAs: 'vm'
                    }
                }
            })

 接收参数:

 $stateParams.id

  其实ui-sref和$state.go本质上是一个东西,可以看看ui-sref源码

 

posted @ 2017-08-31 16:12  saygoodnight  阅读(273)  评论(0编辑  收藏  举报