2015-12-29 67 views

回答

0
<input type="email" ng-pattern="/.*?/" ng-model="email" placeholder="Enter an email here"> 

這裏type="email"自己執行驗證。如果您想允許用戶鍵入任何內容,只需使用不帶type="email"ng-pattern="/.*?/"的常規輸入即可。

+0

我不能刪除TYPE =「電子郵件」,因爲它是移動有用(電子郵件投入使用另一個鍵盤(包含「@」在主視圖中的字符,等等) – fj123x

+0

我明白了,你應該編輯你的問題來補充說明,無論如何,我認爲你發佈的答案是正確的方法。 –

0
module.directive('ngRemoveEmailValidation', function(){ 
     return { 
      require : 'ngModel', 
      link : function(scope, element, attrs, ngModel) { 
       ngModel.$validators["email"] = function() { 
        return true; 
       }; 
      } 
     } 
    }); 

我使用這個指令爲「搭橋」的驗證