Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 9bc5207

Browse files
bekospkozlowski-opensource
authored andcommitted
feat(timepicker): add timepicker directive
1 parent e1bff6b commit 9bc5207

File tree

6 files changed

+930
-0
lines changed

6 files changed

+930
-0
lines changed

src/timepicker/docs/demo.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<div ng-controller="TimepickerDemoCtrl">
2+
<timepicker ng-model="mytime" hour-step="hstep" minute-step="mstep" show-meridian="ismeridian"></timepicker>
3+
4+
<pre>Time is: {{mytime | date:'shortTime' }}</pre>
5+
6+
<div>Hours step is: <select ng-model="hstep" ng-options="opt for opt in options.hstep"></select></div>
7+
<div>Minutes step is: <select ng-model="mstep" ng-options="opt for opt in options.mstep"></select></div>
8+
9+
<button class="btn" ng-click="toggleMode()">12H / 24H</button>
10+
<button class="btn" ng-click="update()">Set to 14:00</button>
11+
<button class="btn btn-danger" ng-click="clear()">Clear</button>
12+
</div>

src/timepicker/docs/demo.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var TimepickerDemoCtrl = function ($scope) {
2+
$scope.mytime = new Date();
3+
4+
$scope.hstep = 1;
5+
$scope.mstep = 15;
6+
7+
$scope.options = {
8+
hstep: [1, 2, 3],
9+
mstep: [1, 5, 10, 15, 25, 30]
10+
};
11+
12+
$scope.ismeridian = true;
13+
$scope.toggleMode = function() {
14+
$scope.ismeridian = ! $scope.ismeridian;
15+
};
16+
17+
$scope.update = function() {
18+
var d = new Date();
19+
d.setHours( 14 );
20+
d.setMinutes( 0 );
21+
$scope.mytime = d;
22+
};
23+
24+
$scope.clear = function() {
25+
$scope.mytime = null;
26+
};
27+
};

src/timepicker/docs/readme.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
A lightweight & configurable timepicker directive.
2+
3+
### Settings ###
4+
5+
All settings can be provided as attributes in the `<timepicker>` or globally configured through the `timepickerConfig`.
6+
7+
* `ng-model` <i class="icon-eye-open"></i>
8+
:
9+
The Date object that provides the time state.
10+
11+
* `hour-step` <i class="icon-eye-open"></i>
12+
_(Defaults: 1)_ :
13+
Number of hours to increase or decrease when using a button.
14+
15+
* `minute-step` <i class="icon-eye-open"></i>
16+
_(Defaults: 1)_ :
17+
Number of minutes to increase or decrease when using a button.
18+
19+
* `show-meridian` <i class="icon-eye-open"></i>
20+
_(Defaults: true)_ :
21+
Whether to display 12H or 24H mode.
22+
23+
* `meridians`
24+
_(Defaults: ['AM', 'PM'])_ :
25+
Meridian labels
26+
27+
* `readonly-input`
28+
_(Defaults: false)_ :
29+
Whether user can type inside the hours & minutes input.
30+
31+
* `mousewheel`
32+
_(Defaults: true)_ :
33+
Whether user can scroll inside the hours & minutes input to increase or decrease it's values.

0 commit comments

Comments
 (0)