0
我正在嘗試在離子/ angularjs中執行必需的字段驗證,並且它似乎沒有觸發{{user。$ invalid}}當我與形成。在角度和離子方面是新的,所以在這種情況下做正確的字段驗證是正確的。
<form novalidate >
<div class="list">
<label class="item item-input">
<span class="input-label">Username</span>
<input type="text" ng-model="user.uname" required>
<div class="error-container" ng-show="user.uname.$dirty && user.uname.$invalid">
<small class="error" ng-show="user.uname.$error.required">Please input a uname</small>
</div>
</label>
<label class="item item-input">
<span class="input-label">Password</span>
<input type="password" ng-model="user.pwd" required>
<div class="error-container" ng-show="user.pwd.$dirty && user.pwd.$invalid">
<small class="error" ng-show="user.pwd.$error.required">Please input a password</small>
</div>
</label>
<label class="item">
<div lass="error-container">{{message}}</div>
<div lass="error-container">Invalid:{{user.$invalid}}</div>
<button class="button button-block button-positive" ng-disabled="user.$invalid" ng-click="login(user)">Log in</button>
</label>
</div>
</form>