zr-datepicker
v3.1.1
Published
This is a date picker directive.
Downloads
7
Readme
About
This is a date picker directive.
Installation
Install through npm:
npm install --save zr-datepicker
Then include in your apps module:
import { NgModule } from '@angular/core';
import { ZrDatepickerModule } from 'zr-datepicker';
@NgModule({
imports: [
ZrDatepickerModule
]
})
export class MyModule {}
Finally use in one of your apps components:
template-driven form
import { Component } from '@angular/core';
@Component({
template: `<input class="form-control" type="text" appDatepicker [format]="'yyyy-mm-dd hh:ii:00'" [(ngModel)]="date1" />`
})
export class MyComponent {
date1: any;
}
reactive form
import { Component } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
@Component({
template: `<form role="form" [formGroup]="form">
<input class="form-control" type="text" formControlName="icon" appDatepicker [format]="'yyyy-mm-dd hh:ii:00'" />
</form>`
})
export class MyComponent {
form: FormGroup;
constructor(private formBuilder: FormBuilder) {
this.buildForm();
}
private buildForm() {
this.form = this.formBuilder.group({
icon: [null]
})
}
}