2017-09-24 8 views
0

私はユーザープロファイルメタデータをプロミスとしてプロミスとして取得しようとしていますが、これは別のプロミスによって使用され、ユーザープロファイルの値に基づいて情報を取得します。解決法におけるAngularJSインジェクションエラー

myApp.config(function myAppConfig ($routeProvider, authProvider, $httpProvider, $locationProvider, jwtInterceptorProvider) { 

    $routeProvider.when('/wapmap', { 
     templateUrl: 'wap_tools/wap_map.html', 
     controller: 'wapMapClr', 
     resolve: { 
      mapres: function(profilePromise, service2) { 
       profilePromise.then(function(profile) { 
        var viewerId = profile.app_metadata.viewers[1].viewerId; 
        return service2.getPromise(viewerId) 
       }) 
        .then(function(response2) {  
         makelayerGroup(response2); 
         mapView(response2); 
         hasPhotos = response2.vwrSettings[0].photos; 
         return 
        }) 
      }) 
      } 
     }, 
     requiresLogin: true 
    }); 

これはauthProviderです。これは設定にも含まれています。

  authProvider.init({ 
      domain: 'someapp.eu.auth0.com', 
      clientID: 'abcdsefghqwert12345', 
      callbackURL: location.href, 
      //URL when not logged in 
      loginUrl: '/Login' 

      }); 


     authProvider.on('loginSuccess', function($rootScope, $location, profilePromise, idToken, store, auth, userService) { 
     console.log("Login Success"); 
     profilePromise.then(function(profile) { 

      userService.setUser(auth.profile); 

      store.set('profile', profile); 
      store.set('token', idToken); 
      $location.path('/wapmap'); 
     }); 
     $rootScope.loggedIn = auth.isAuthenticated; 
     $location.path('/wapmap'); 
     }); 

これは、次のエラーがスローされます。

 [$injector:unpr] Unknown provider: profilePromiseProvider <- profilePromise <- mapres 
    http://errors.angularjs.org/1.5.8/$injector/unpr?p0=profilePromiseProvider%20%3C-%20profilePromise%20%3C-%20mapres 
      at angular.js:68 
      at angular.js:4511 
      at Object.getService [as get] (angular.js:4664) 
      at angular.js:4516 
      at getService (angular.js:4664) 
      at injectionArgs (angular.js:4688) 
      at Object.invoke (angular.js:4710) 
      at angular-route.min.js:10 
      at Object.forEach (angular.js:335) 
      at angular-route.min.js:10 

は、これは、射出エラーのように見える - 私は解決にprofilePromiseデータを得るのですか?

+0

開発中angular.jsの縮小さバージョンを使用しないでくださいがロードされていることを確認してください。 –

+0

プロファイル設定を.config(['$ routeProvider'、 'profilePromise'、function($ routeProvider、profilePromise){$ routeProvider.when ... – lingthe

+0

に埋め込むようにしてください。profilePromiseサービスをご利用ください。 –

答えて

2

errorを示しています:

Unknown provider: profilePromiseProvider <- profilePromise <- mapres

はあなたが適切profilePromiseサービス/工場を定義し、それが

関連する問題