Get DB Value In Angular Config
<p>I have an app that uses angular. In the app.config is where I have to setup my routes, however I want to authorize my routes because not everyone who uses the app can see every page.</p>

<p>So I have already tried to make a factory that gives a boolean to tell the app if that person can see the route or not, and learned that I cannot inject a factory into a config.</p>

<p>So I have made a provider that I can inject into the config:</p>

<pre><code>(function () {
    'use strict';

    angular.module('services')
    .factory('Auth', ['$http', function AuthFactory($http) {
        return {
            LinkAuth: function (Name) {
                return $http({ method: 'GET', url: '/Dashboard/AuthorizeNavItem', data: { Name: Name } });
            }
        }
    }]);


    angular.module('services')
    .provider('AuthProvider', ['Auth', function (Auth) {
        var allowed = false;

        this.$get = function (Name) {
            Auth.LinkAuth(Name).success(function (data) {
                allowed = data.Authorized;
            });

            return allowed;
        }

    }]);
})();
</code></pre>

<p>My app.config:</p>

<pre><code>(function () {
    'use strict';

    angular.module('app.it', [])
    .config(['$stateProvider', 'msNavigationServiceProvider', 'AuthProvider', function ($stateProvider, msNavigationServiceProvider, AuthProvider) {

        $stateProvider
        .state('app.it', {
            abstract: true,
            url: '/information-technology',
        })
        .state('app.it.users', {
            url: '/users',
            views: {
                'content@app': {
                    templateUrl: '/IT/Users',
                    controller: 'ITUserController as vm'
                }
            }
        });

        /*
            We need to get a bool to say if a user is part of a group that can see this page.
        */
        var allowed = true;//I want the provider $get method to return that bool here

        if (allowed)
        {
           //This builds the navigation bar
            msNavigationServiceProvider.saveItem('app.authroute', {
                title: 'Authorized Route',
                icon: 'icon-monitor',
                weight: 2
            });

            //This builds the navigation bar
            msNavigationServiceProvider.saveItem('app.authroute.route', {
                title: 'Route',
                state: 'app.authroute.route'
            });
        }


    }]);

})();
</code></pre>

<p>How do I access that AuthProvider $get and store the bool in a variable in the config?</p>