Click to expand!
Option 1 (NPM)
Install it via npm:
npm i html-duration-picker
Option 2 (CDN)
Include it in your HTML file, just before the </body>
tag. Like this:
<script src="https://cdn.jsdelivr.net/npm/html-duration-picker@latest/dist/html-duration-picker.min.js"></script>
</body>
Option 3 (Download and Include)
-
To start using html-duration-picker, just download html-duration-picker.min.js from the dist/ folder.
-
Include it in your HTML file, just before the
</body>
tag. Like this:
<script src="html-duration-picker.min.js"></script>
</body>
Add a html-duration-picker
class on any <input>
box. Like this:
<input class="html-duration-picker">
To update dynamically loaded input boxes, you execute
HtmlDurationPicker.refresh();
That's it! Let the magic happen!
Click to expand!
Install the package via npm
npm i html-duration-picker
- Import the package in your Component
import * as HtmlDurationPicker from 'html-duration-picker';
- Add a
html-duration-picker
class on any<input>
box. Like this:
<input type="text" [className]="'html-duration-picker'">
- Initialize the HtmlDurationPicker for the Component
ngAfterViewInit() {
HtmlDurationPicker.init();
}
To update dynamically loaded input boxes, you execute
HtmlDurationPicker.refresh();
That's it! Let the magic happen!
Set default value to 15 minutes
<input type="text" class="html-duration-picker" data-duration="00:15:00">
Set maximum value to 35 minutes
<input type="text" class="html-duration-picker" data-duration-max="00:35:00">
Set minimum value to 5 minutes
<input type="text" class="html-duration-picker" data-duration-min="00:05:00">
Hide seconds
<input type="text" class="html-duration-picker" data-hide-seconds>