Skip to content

how to lazy load a controller whose name has a variable from the $stateParams in resolve's dummy? #18

@yuzhibin

Description

@yuzhibin

My code is like this:
.state('partials.main', {
// parent: 'partials',
url: '/{func}/main',
resolve: {
dummy: function ($stateParams){
var s = $couchPotatoProvider.resolveDependencies(['controllers/'+$stateParams.func+'Controller']);
return s;
}
},
templateUrl:
function ($stateParams){
return '/partials/'+$stateParams.func + '/main.html';
},
controllerProvider:
function ($stateParams){
return $stateParams.func + 'Controller';
}
})

but the code:

resolve: {
dummy: function ($stateParams){
var s = $couchPotatoProvider.resolveDependencies(['controllers/'+$stateParams.func+'Controller']);
return s;
}

does not work!

can I get any help ?
thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions