I have the following state configuration:
$stateProvider .state('customer', { url: '/customers', templateUrl: 'app/components/customer/templates/main.tpl.html', views: { 'list': { templateUrl: 'app/components/customer/templates/list.tpl.html', controller: 'ListCtrl as ctrl' } }, resolve: { customerList: function ($stateParams, CustomerResource) { console.log('trying to resolve'); var list = CustomerResource.list($stateParams); return list; } } })
Here is the main template:
<div class="container"> <div class="row"> <div ui-view="list" class="col-lg-4"/> <div ui-view="details" class="col-lg-8"/> </div> </div>
I see on the console that angular is trying to resolve the dependency. But this dependency is never entered into the controller under views . What am I doing wrong here?
PS When I move views to some child state of type customer.test , the resolved dependency is injected as expected:
.state('customer.test', { url: '/test', views: { 'list@customer': { templateUrl: 'app/components/customer/templates/list.tpl.html', controller: 'ListCtrl as ctrl' } } })
angularjs state angular-ui-router
damluar
source share