尝试调用我的授权服务时未知的提供程序

时间:2018-03-29 14:58:34

标签: angularjs web authorization router

在我的angular 1.5 app中,我尝试调用授权服务以预测当前用户的组。

我在加载应用程序之前通过添加到routerProvider来阅读这样做的方法。

但是我觉得这是不可能的,因为那时服务没有初始化:

  app.config(['$stateProvider', '$urlRouterProvider', '$compileProvider', 'authorizationService',
        function ($stateProvider, $urlRouterProvider, $compileProvider, authorizationService) {

            $compileProvider.preAssignBindingsEnabled(true);

            $urlRouterProvider.otherwise('/');

            $stateProvider.state('home', {
                url: '/',
                template: '<home-component></home-component>',
                component: 'homeComponent',
                params: {
                    selectedFilter: undefined
                },
                resolve: {
                    ldapGroup: function (authorizationService) {
                        return authorizationService.getLdapGroup().then(
                            function successCallback(data) {
                                $scope.isAdOps = data;
                            },
                            function errorCallback(response) {
                                // called asynchronously if an error occurs
                                // or server returns response with an error status.
                                console.log(response);
                            }
                        );
                    }
                }
            })

我明白了:

Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:unpr] Unknown provider: authorizationService

0 个答案:

没有答案