[英]material design angular input require
Angular Material Design是否要求輸入ng模型等於變量才能滿足要求?
不使用Material Design,以下錯誤檢查完全正常。
<label>First Name (as it appears on your card)</label>
<input type="text" name="firstName" data-ng-model="test" required/>
但是,使用Material Design時,除非用戶鍵入內容,刪除它並鍵入其他內容,否則以下內容始終返回無效。
<md-input-container>
<label>First Name (as it appears on your card)</label>
<input type="text" name="firstName" data-ng-model="test" required/>
</md-input-container>
但是,我將測試設置為范圍內的某些內容,然后錯誤檢查工作正常:
$scope.test = 'this value';
有沒有辦法使用Material Design進行錯誤檢查而無需為字段指定默認值?
我想你可能沒有在控制器中初始化ng-model變量。
嘗試初始化變量$scope.test = '';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.