2017-02-17 70 views
0

我有一個輸入字段

<input name="email" ng-model="vm.newOrder.email" 
required autofocus ng-blur="vm.getUser(vm.newOrder.email)"/> 

我想打電話領域模糊的功能,檢查是否與此電子郵件用戶存在。如果不是,我試圖打開一個對話框。

 function getUser(email) { 
     if (vm.buyerForm.email.$valid && email !== '') { 
      return siteAuthService.getUserByEmail(email, params.serverId) 
       .then((respUser) => { 
         ... 
         //bla 
        } 
        else { 
         vm.isUserExists = false; 
         // createAccountDialog(email); 
         var modal = $uibModal.open({ 
          template: require('../../dialogs/formOrderDialog/newSiteUserDialog.tmpl.html'), 
          controller: 'newSiteUserDialogController', 
          controllerAs: 'vm', 
          resolve: { 
           email: vm.newOrder.email, 
           phone: vm.newOrder.phone, 
           server: params.serverId 
          } 

         }); 
         modal.result.then((usr => { 
          vm.isUserExists = usr.created; 
          if (usr.phone) { 
           vm.newOrder.phone = usr.phone; 
          } 
          // if(usr.) 
         })); 

        } 
       }); 
     } 

但在情況下用戶不存在,我才能上$ uibModal.open行錯誤:

[$injector:unpr] Unknown provider: [email protected] <- [email protected] 

與電子郵件字段值。我真的不明白這個錯誤是關於什麼的。

回答

0

所以問題的決心對象:

resolve: { 
      user: function() { 
      return { 
        email: vm.newOrder.email, 
        phone: vm.newOrder.phone, 
        server: params.serverId 
       }; 
       } 
     } 
相關問題