|
5 | 5 | *
|
6 | 6 | * @param {date} date Must be a Javascript Date - to be displayed in the input. Can be left empty.
|
7 | 7 | * @param {string} format Optional date format for displayed dates ('MM/dd/yyyy' by default).
|
| 8 | + * @param {function} on-date-change Optional user defined function which is called when the date is changed by the picker.<br/> |
8 | 9 | * @param {boolean} isOpen Optional boolean for determining whether or not to have the datepicker default to open (false by default).
|
9 | 10 | * @param {string} popupPlacement Optional configuration string used to position the popup datepicker relative to the input element. See {@link https://angular-ui.github.io/bootstrap/#datepickerPopup Angular UI Datepicker Popup}.
|
10 | 11 | * @param {object} dateOptions Optional uib-datepicker configuration object. See {@link https://angular-ui.github.io/bootstrap/#datepicker Angular UI Datepicker}.
|
|
16 | 17 | <example module="patternfly.datepicker">
|
17 | 18 |
|
18 | 19 | <file name="index.html">
|
19 |
| - <div ng-controller="DemoBootstrapDatepicker"> |
20 |
| - <pf-bootstrap-datepicker |
21 |
| - date="date"> |
22 |
| - </pf-bootstrap-datepicker> |
23 |
| - <pf-bootstrap-datepicker |
24 |
| - date="" |
| 20 | + <div ng-controller="DemoBootstrapDatepicker" class="row example-container"> |
| 21 | + <div class="form-group"> |
| 22 | + <label class="col-sm-2 control-label" for="date-one">Date One:</label> |
| 23 | + <pf-bootstrap-datepicker |
| 24 | + id="date-one" |
| 25 | + date="dateOne" |
| 26 | + on-date-change="firstDateChanged(newDate)"> |
| 27 | + </pf-bootstrap-datepicker> |
| 28 | + <label class="col-sm-2 control-label" for="date-one">Date Two:</label> |
| 29 | + <pf-bootstrap-datepicker |
| 30 | + id="date-two" |
| 31 | + date="dateTwo" |
25 | 32 | format="{{format1}}"
|
26 | 33 | is-open="isOpen"
|
27 | 34 | popup-placement="{{popupPlacement}}"
|
28 |
| - date-options="dateOptions"> |
29 |
| - </pf-bootstrap-datepicker> |
| 35 | + date-options="dateOptions" |
| 36 | + on-date-change="secondDateChanged(newDate)"> |
| 37 | + </pf-bootstrap-datepicker> |
| 38 | + </div> |
| 39 | + <div class="col-md-12"> |
| 40 | + <label style="font-weight:normal;vertical-align:center;">Events: </label> |
| 41 | + </div> |
| 42 | + <div class="col-md-12"> |
| 43 | + <textarea rows="10" class="col-md-12">{{eventText}}</textarea> |
| 44 | + </div> |
30 | 45 | </div>
|
31 | 46 | </file>
|
32 | 47 |
|
33 | 48 | <file name="script.js">
|
34 | 49 | angular.module('patternfly.datepicker').controller('DemoBootstrapDatepicker', function( $scope ) {
|
| 50 | + $scope.eventText = ''; |
35 | 51 |
|
36 | 52 | // first datepicker
|
37 |
| - $scope.date = new Date("Jan 1, 2000"); |
| 53 | + $scope.dateOne = new Date("Jan 1, 2000"); |
| 54 | + $scope.firstDateChanged = function(date) { |
| 55 | + $scope.eventText = 'Date One Updated to: ' + date + '\r\n' + $scope.eventText; |
| 56 | + }; |
38 | 57 |
|
39 | 58 | // second datepicker
|
| 59 | + $scope.dateTwo = new Date("Feb 1, 2000"); |
40 | 60 | $scope.format1 = "MM/dd/yy";
|
41 | 61 | $scope.dateOptions = {
|
42 | 62 | showWeeks : true
|
43 | 63 | };
|
44 | 64 | $scope.isOpen = true;
|
45 | 65 | $scope.popupPlacement = "bottom-left";
|
| 66 | +
|
| 67 | + $scope.secondDateChanged = function(date) { |
| 68 | + $scope.eventText = 'Date Two Updated to: ' + date + '\r\n' + $scope.eventText; |
| 69 | + }; |
46 | 70 | });
|
47 | 71 | </file>
|
48 | 72 |
|
|
0 commit comments