我有一个required tag
在我的输入中使用的表单 - 这工作正常,但在我的提交按钮上,我有在ng-click="visible = false"
提交数据时隐藏表单。
如果所有验证都正确,我怎么能使它只设置为 false?
应用程序.js
$scope.newBirthday = function(){
$scope.bdays.push({name:$scope.bdayname, date:$scope.bdaydate});
$scope.bdayname = '';
$scope.bdaydate = '';
};
HTML:
<form name="birthdayAdd" ng-show="visible" ng-submit="newBirthday()">
<label>Name:</label>
<input type="text" ng-model="bdayname" required/>
<label>Date:</label>
<input type="date" ng-model="bdaydate" required/>
<br/>
<button class="btn" ng-click="visible = false" type="submit">Save</button>
</form>