0
  1. In the configure.js:

    $stateProvider.state('home', {
        url: '/',
            views: {
                'nav-menu': {
                    templateUrl: '/views/nav-menu.ng',
                    controller: 'myApp.NavMenuController',
                    controllerAs: 'ctrl',
                    resolve: myApp.NavMenuController.resolve
                }
            }
        }
    });
    
  2. In the controller.js:

    myApp.NavMenuController.resolve = {
        person: function($q) {
            return $q.defer().promise;
        }
    };
    

Error Message:

Error: [$injector:modulerr] Failed to instantiate module myApp due to: TypeError: Cannot read property 'resolve' of undefined

Logan Wayne
  • 6,001
  • 16
  • 31
  • 49
Leon
  • 1
  • 1
  • The error is saying `myApp.NavMenuController` is undefined. You're trying to reference this function somewhere w/out having an actual reference to the controller. Put the function on a service that you can inject into the configure function. – Sunil D. Oct 11 '15 at 00:56
  • But it only fails for unit test. The resolver works fine in the real app. – Leon Oct 13 '15 at 22:22

0 Answers0