Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在config.js for angular js应用程序中正确注入adalprovier_Javascript_Jquery_Angularjs - Fatal编程技术网

Javascript 如何在config.js for angular js应用程序中正确注入adalprovier

Javascript 如何在config.js for angular js应用程序中正确注入adalprovier,javascript,jquery,angularjs,Javascript,Jquery,Angularjs,我有下面的代码 app.js (function () { angular.module('inspinia', [ 'ui.router', // Routing 'oc.lazyLoad', // ocLazyLoad 'ui.bootstrap', // Ui Bootstrap 'pascalprecht.tran

我有下面的代码

app.js

(function () {
    angular.module('inspinia', [
        'ui.router',                    // Routing
        'oc.lazyLoad',                  // ocLazyLoad
        'ui.bootstrap',                 // Ui Bootstrap
        'pascalprecht.translate',       // Angular Translate
        'ngIdle',                       // Idle timer
        'AdalAngular'                   //ADAL JS Angular
    ])
})();
和config.js

function config($stateProvider, $urlRouterProvider, $ocLazyLoadProvider, IdleProvider, KeepaliveProvider, adalProvider) {

    adalProvider.init(
       {
           instance: 'https://login.microsoftonline.com/',
           tenant: 'mysaasapp.onmicrosoft.com',
           clientId: '33e037a7-b1aa-42ab-9693-6c22d01ca338',
           extraQueryParameter: 'nux=1',
           //cacheLocation: 'localStorage', // enable this for IE, as sessionStorage does not work for localhost.
       },
       $httpProvider
       );

    // Configure Idle settings
    IdleProvider.idle(5); // in seconds
    IdleProvider.timeout(120); // in seconds

    $urlRouterProvider.otherwise("/dashboards/dashboard_1");

    $ocLazyLoadProvider.config({
        // Set to true if you want to see what and when is dynamically loaded
        debug: false
    });

    $stateProvider

        .state('dashboards', {
            abstract: true,
            url: "/dashboards",
            templateUrl: "views/common/content.html",
        })
        .state('dashboards.dashboard_1', {
            url: "/dashboard_1",
            templateUrl: "views/dashboard_1.html",
            requireADLogin: true,
然而,我得到了一个巨大的例外:

> Error: [$injector:modulerr]
> http://errors.angularjs.org/1.3.7/$injector/modulerr?p0=inspinia&p1=%5B%24injector%3Aunpr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.3.7%2F%24injector%2Funpr%3Fp0%3DadalProvider%0AT%2F%3C%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A6%3A416%0AOb%2Fn.%24injector%3C%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A38%3A307%0Ad%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A36%3A308%0Ae%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A37%3A64%0Ad%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A35%3A293%0Ag%2F%3C%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A35%3A425%0As%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A7%3A300%0Ag%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A35%3A202%0AOb%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A38%3A435%0Asc%2Fd%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A17%3A350%0Asc%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A18%3A153%0AJd%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A16%3A483%0A%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A249%3A412%0An.Callbacks%2Fj%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fjquery%2Fjquery-2.1.1.min.js%3A2%3A26855%0An.Callbacks%2Fk.fireWith%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fjquery%2Fjquery-2.1.1.min.js%3A2%3A27673%0A.ready%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fjquery%2Fjquery-2.1.1.min.js%3A2%3A29465%0AI%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fjquery%2Fjquery-2.1.1.min.js%3A2%3A29656%0A%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fapp.js%3A15%3A6%0A
> angular.min.js:6:415 Error: [$injector:modulerr]
> http://errors.angularjs.org/1.3.7/$injector/modulerr?p0=inspinia&p1=%5B%24injector%3Aunpr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.3.7%2F%24injector%2Funpr%3Fp0%3DadalProvider%0AT%2F%3C%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A6%3A416%0AOb%2Fn.%24injector%3C%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A38%3A307%0Ad%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A36%3A308%0Ae%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A37%3A64%0Ad%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A35%3A293%0Ag%2F%3C%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A35%3A425%0As%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A7%3A300%0Ag%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A35%3A202%0AOb%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A38%3A435%0Asc%2Fd%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A17%3A350%0Asc%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A18%3A153%0AJd%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A16%3A483%0A%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fangular%2Fangular.min.js%3A249%3A412%0An.Callbacks%2Fj%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fjquery%2Fjquery-2.1.1.min.js%3A2%3A26855%0An.Callbacks%2Fk.fireWith%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fjquery%2Fjquery-2.1.1.min.js%3A2%3A27673%0A.ready%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fjquery%2Fjquery-2.1.1.min.js%3A2%3A29465%0AI%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fjquery%2Fjquery-2.1.1.min.js%3A2%3A29656%0A%40http%3A%2F%2Flocalhost%3A21425%2Fjs%2Fapp.js%3A15%3A6%0A
> angular.min.js:6:415
我在config.js中明确了这一点,adalProvider),如果我删除它,它将重新开始工作

我的代码基于以下内容:


不同的是,在该示例中,他们在同一个应用程序上进行配置。js

AdalProvider
不是
provider
的正确名称,它应该是
adalAuthenticationServiceProvider

如果将
AdalProvider
用作已注入数组的依赖项的引用,因为您直接将依赖项注入函数中,那么该依赖项将是
adalAuthenticationServiceProvider
,而不是
AdalProvider

代码

function config($stateProvider, $urlRouterProvider, $ocLazyLoadProvider, IdleProvider, KeepaliveProvider, adalAuthenticationServiceProvider)

你能详细解释一下吗?顺便说一句,问题仍然存在,在config.js中用adalAuthenticationServiceProvider替换adalProvider之后,也许我们建议包含这段代码,它位于config.js的末尾,您还应该替换app.js中的引用,如
adalProvider.init
将替换为
adalAuthenticationServiceProvider.init
@EstebanV您应该关闭它。更改后它能工作吗?