Preface
Clicking a ui-sref links wont refresh named views' controller.
Question
How can I refresh the WeeklyCtrl
When clicking on a ui-sref="root.store.page.ad({ adSlug: promo.code })"
from SidePanelCtrl
note there is a reload on the page. I see the favicon blink but no re-init of any controllers routes.js
$stateProvider
.state('root', {
url: '/',
abstract: true,
views: {
'': {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
}
}
})
.state('root.store', {
url: ':storeSlug',
views: {
'sidepanel': {
templateUrl: 'views/partials/side-panel.html',
controller: 'SidePanelCtrl'
},
'weekly': {
templateUrl: 'views/partials/weekly.html',
controller: 'WeeklyCtrl'
},
}
})
.state('root.store.page', {
url: '/page',
})
.state('root.store.page.ad', {
url: '/:adSlug',
})
index.html
<div ui-view=""></div>
main.html
<div ui-view="weekly"></div>
<div ui-view="sidepanel"></div>
side-panel.html
<a ng-repeat="promo in promos" ui-sref="root.store.page.ad({ adSlug: promo.code })" >
<h3>...</h3>
</a>
When WeeklyCtrl
init it triggers an api call to will trigger.
Pages.details.getPages($scope).success(function(data){
console.log(data);
});
In the end I want this to trigger again when I switch between promos
UPDATE:
On click of a link:
API responds 3 times. controller reinits multiple times