Sean
Sean

Reputation: 15164

StateProvider Resolve not firing when minimized

Without minification, my code runs fine, but when it is minified, the load function is not called:

$stateProvider
    // logged-in pages ------------------------
    .state("app", {
        abstract: true,
        template: "<div ui-view></div>",
        resolve: {
            load: function (appStarter) {
                console.log("app.load");
                var appStarterPromise = appStarter.start();
                return appStarterPromise.then(function () {

                    $("body").removeClass("loading");
                });
            }
        }
    }).state("app.home", {
    //...

Any idea why this is not firing, or how to debug it?

Upvotes: 0

Views: 64

Answers (1)

Billy
Billy

Reputation: 1104

Try this:

    resolve: {
        load: ['appStarter', function (appStarter) {
            console.log("app.load");
            var appStarterPromise = appStarter.start();
            return appStarterPromise.then(function () {

                $("body").removeClass("loading");
            });
        }]
    }

This is how you inject dependencies, minification proof!

Upvotes: 1

Related Questions