Wait for parent's permission

In accordance with:

https://github.com/angular-ui/ui-router/wiki/Nested-States-%26-Nested-Views#what-do-child-states-inherit-from-parent-states

I pasted the code.

I am trying to get kids to wait for parent's permission. Everything is working correctly, but the problem is that the child controller is not being created. Why?

edit:

$stateProvider.state('parent', {
url: 'parent',
  resolve:{
     resA:  function(){
        return {'value': 'A'};
     }
  },
  controller: function($scope, resA){
      $scope.resA = resA.value;
  }
})
.state('parent.child', {
url: '/child',
  resolve:{
     resB: function(resA){
         console.log('resolve invoked'); // it fires
        return {'value': resA.value + 'B'};
     }
  },
  controller: function($scope, resA, resB){
console.log('done'); //never fired
      $scope.resA2 = resA.value;
      $scope.resB = resB.value;
  }

      

I don't think templates are needed here.

+3


source to share





All Articles