参数传递

注意:路由(route)中配置定义参数别名

伪代码如下:

一、controller:

/**

* 视图--字典值

*/

$scope.queryValuePagedResult = function(keyId) {

$state.go( 'basis.data.dictionary.value.pagedResultView',{keyId:keyId});

}

二、

路由:

route.js

.state( 'basis.data.dictionary.value.pagedResultView', {

params:{keyId:null}, 

views : {

'basis-data-dictionary-value-view' : {

templateUrl : urlManager.$viewUrls.$getUrl( 'basis/data/dictionary/value/pagedResultView' )

}

}

} )

三、

跳转所在控制器,参数接受:

// 改变页码

$scope.changeValueIndex = function($index, $event) {

var keyId = $stateParams.keyId; //接受传递的keyid,记得在控制器中注入$stateParams

dataDictionaryValueService.queryListByRequireKey(keyId,$index).success(function(returnData){

console.log(returnData.moreData.data);

$scope.pagedValueResultInfo=returnData.moreData.data;//

});

}

猜你喜欢

转载自yingyingsheji.iteye.com/blog/2355714