Home Parent resolve not running for child route on refresh - AngularJS
Reply: 0

Parent resolve not running for child route on refresh - AngularJS

user1373 Published in July 20, 2018, 5:04 am

I am having an issue with AngularJS where I want a resolve in a parent route to run before the child route is activated.

When I navigate to the child route using $state.go('parent.child'); then the parent resolve runs.

However, when I refresh the page (so presumably when angularjs maps a url to a route) only the child resolve rusn.

According to the docs, I only need to infer the state hierarchy using the dot notation, but I have also specified this using the parent property of the child state.

It also states in the docs that resolves from parent states are inherited, so I'm thinking it should always run the parent resolve.

Can someone tell me why the parent resolve might not be running? Thanks.

  .state('root', {
    url: '',
    template: '<ui-view/>',
    resolve: {
      user: function(Auth) {
        console.log('ROOT STATE RESOLVE');
  .state('root.listview', {
    parent: 'root',
    url: '/events/{teamID:' + ID_MATCH + '}',
    templateUrl: 'app/controllers/events/events.html',
    controller: 'ListController',
    controllerAs: 'ctrl',
    resolve: {
      items: function(Items) {
        console.log('CHILD STATE RESOLVE');
        return Items.get();
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.320715 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO