1.0.3 • Published 7 years ago
ng-flatpickerr v1.0.3
ng-flatpicker
Angularjs directive for flatpickr.Pleas do the following to use ng-flatpicker.
- just add
ng-flatpickerto your input.Default dateformat isY-m-d. - You can specify alot of options. To do that just add
optionsattribute object in your element.
Prerequires
Before installation you must to include flatpickr to your project.
Installation
Install with npm
npm i ng-flatpickerrAfter run the above command
- Include
ng-flatpicker.min.jsto your project. - And then add
ng-flatpickermodules to your angularjs application.
Example
var myapp = angular.module("myapp", ["ng-flatpicker"]);Usage
To use ng-flatpicker you just need add ng-flatpicker attribute and options to your element.
<input
type="text"
ng-flatpicker
options="{dateFormat:'Y-m-d'}"
placeholder="Select a date"
ng-model="demoDate"
/>Example with angularjs
Define options to your controller.
var myapp = angular.module("myapp", ["ng-flatpicker"]);
angular.module("myapp").controller("demoCtrl", function($scope) {
$scope.options = {
dateFormat: "Y-m-d",
enabledTime: true
};
});and then to your view file
<input
type="text"
ng-flatpicker
options="options"
placeholder="Select a date"
ng-model="demoDate"
/>Note: Need to deine ng-model in your element.
License
ng-flatpicker module is under MIT license see project root