3

i'm trying achieve something like this :

 $stateProvider.state('app', {
        url: "/app",
        templateUrl: "assets/views/app.html",
        resolve: {
            authorize: ['authorization',
                function(authorization) {
                    return authorization.authorize();
                }
            ],
            loadSequence: loadSequence('chartjs', 'chart.js', 'chatCtrl')
        },
        abstract: true

resolving "authorize" then "LoadSequence" function, but the error i get is confusing and i can't figure out how to do it properly :

Error: ng:areq Bad Argument Argument 'fn' is not a function, got Object

Best regards.

1
  • Did you fix it? Were you able to inject authorize in the controller? I'm having the same issue. Commented Oct 17, 2017 at 6:07

1 Answer 1

1

I think you need to wrap the second item in resolve in a function like you did the first one:

$stateProvider.state('app', {
    url: "/app",
    templateUrl: "assets/views/app.html",
    resolve: {
        authorize: ['authorization',
            function(authorization) {
                return authorization.authorize();
            }
        ],
        loadSequence: function(){
            return loadSequence('chartjs', 'chart.js', 'chatCtrl');
        }
    },
    abstract: true

Also, if loadSequence does not return a promise, it needs to.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.