ionic路由传值
app.js
=====================================
//新建工作任务
.state(‘app.newTask’, angularAMD.route({
url: ‘/newTask?:userid:username:img:isclear:arr1:arr2:arr3′,
//cache:’false’,
views: {
‘menuContent’: {
templateUrl: ‘app/templates/oa/NewTask.html’,
controller: ‘NewTaskCtrl’
}
},
//templateUrl: ‘app/templates/oa/NewTask.html’,
//controller: ‘NewTaskCtrl’,
//路由前执行如下
resolve: {
loadController: [‘$q’,’$ocLazyLoad’,
function ($q,$ocLazyLoad)
{
// get the controller name === here as a path to Controller_Name.js
// which is set in main.js path {}
//JS加载交给requirejs管理。ionic框架底层对route进行了绑定,不能oclazyload来加载页面。
//angularAMD:它的作用把angularjs和requirejs结合在一起。
//requirejs+angularAMD可以整合ionic框架,所以按需加载都用requestjs。
//由于不能加载js以外文件,$ocLazyLoad来加载其他。
var load1 = “app/controllers/oa/NewTaskController.js”;
var deferred = $q.defer();
require([load1], function () {
//加载css,requirejs,html等。
$ocLazyLoad.load(
[
{
name: ‘css’,
//insertBefore: ‘#xxx’,
files: [
//’lib/angular-lazy-image/lazy-image-style.css’,
//’app/controllers/discuss/DsMainController.js’
]
}
]
);
deferred.resolve();
});
return deferred.promise;
}]
}
}))
============================
SelectPersonController.js
//负责指定完跳转
$scope.GoPage = function (target,param) {$state.go(target,{userid:$scope.isselect,username:$rootScope.username,img:$rootScope.img});
}
=================================
NewTask.html
<a class=”button button-icon button-clear ion-android-add” style=”font-size: 24px;color: #00A000;” menu-close ng-click=”GoPage(‘app.newTask’,”)”></a>