|
8 | 8 | <link rel="stylesheet" href="bower_components/jquery-ui/themes/smoothness/jquery-ui.css"> |
9 | 9 | </head> |
10 | 10 |
|
11 | | - <body ng-app="ui.date"> |
| 11 | + <body ng-app="MyApp"> |
12 | 12 | <!-- Date --> |
13 | 13 | <div ng-controller='MyCtrl'> |
14 | | - <label for="date">Select Date:</label> |
15 | | - <input type="text" id="date" ui-date="dateOptions" ng-model="aDate"> |
16 | 14 |
|
17 | | - <div>{{ aDate }}</div> |
18 | | - <a href="#" ng-click="logDate()">log date</a> |
| 15 | + <form name="myForm"> |
| 16 | + |
| 17 | + <label for="date">Select Date:</label> |
| 18 | + <input type="text" id="date" ui-date="dateOptions" ng-model="aDate"> |
| 19 | + |
| 20 | + <div>{{ aDate }}</div> |
| 21 | + |
| 22 | + |
| 23 | + <div class="field"> |
| 24 | + Required date: <input type="text" name="date2" required ui-date="" ng-model="reqDate"> |
| 25 | + <div ng-if="myForm.date2.$error.required"> |
| 26 | + The required date field is required. |
| 27 | + </div> |
| 28 | + </div> |
| 29 | + </form> |
| 30 | + |
19 | 31 | </div> |
20 | 32 | <!-- Scripts --> |
21 | 33 | <script type="text/javascript" src="bower_components/jquery/dist/jquery.js"></script> |
22 | 34 | <script type="text/javascript" src="bower_components/jquery-ui/jquery-ui.min.js"></script> |
23 | 35 | <script type="text/javascript" src="bower_components/angular/angular.js"></script> |
24 | 36 | <script type="text/javascript" src="assets/date.js"></script> |
25 | 37 | <script> |
26 | | - angular.module('ui.date').controller('MyCtrl', function($scope) { |
| 38 | + angular.module('MyApp', ['ui.date']) |
| 39 | + .controller('MyCtrl', function($scope) { |
27 | 40 | $scope.aDate = '2015-10-31'; |
28 | 41 | $scope.dateOptions = { |
29 | | - // dateFormat: 'dd/mm/yy', |
30 | | - } |
31 | | - $scope.logDate = function(){ |
32 | | - console.log($scope.aDate); |
| 42 | + dateFormat: 'dd.mm.yy', |
33 | 43 | } |
34 | 44 | }) |
35 | 45 | </script> |
|
0 commit comments