【发布时间】:2017-03-11 18:01:26
【问题描述】:
我需要一个自定义指令/其他方式来验证日期格式 (MM/DD/YYYY)。请帮忙。
<body ng-app="dateInputExample">
<script>
angular.module('dateInputExample', [])
.controller('DateController', ['$scope', function($scope) {
}]);
</script>
<form name="myForm" ng-controller="DateController as dateCtrl">
<label for="exampleInput">Enter Date:</label>
<input type="date" id="exampleInput" name="input" ng-model="example.value" required />
<div role="alert">
<!-- for error display -->
<span class="error" ng-show="myForm.input.$error.required">
Required!</span>
<span class="error" ng-show="myForm.input.$error.date">
Not a valid date!</span>
</div>
</form>
</body>
【问题讨论】:
标签: angularjs validation date