我已经实现了我的控制器:
angular
.module(appSettings.appName)
.controller('someCtrl', function (objectFromResolve) {
var vm = this;
vm.serviceName = objectFromResolve;
})
在另一个文件中,我有状态实现:
angular
.module(appSettings.appName)
.config(function ($stateProvider, $locationProvider) {
$urlRouterProvider.otherwise(appSettings.stateNames.menu);
$stateProvider.state(appSettings.stateNames.root, {
abstract: true,
resolve: {
objectFromResolve: function () {
return {};
}
},
templateUrl: './some_url.html'
}
);
$stateProvider
.state(appSettings.stateNames.menu, {
url: '/menu',
parent: appSettings.stateNames.root,
templateUrl: './some_url2.html',
controller: 'someCtrl(objectFromResolve)',
controllerAs: 'vm'
});
});
我怎样才能像'someCtrl(objectFromResolve)那样传递控制器以便调用它不像一个函数,而是一个字符串和来自解析对象的args ???