ng2-daterangepicker
Advanced tools
Comparing version
@@ -15,2 +15,3 @@ import { AfterViewInit, EventEmitter, ElementRef, OnDestroy } from '@angular/core'; | ||
showDaterangepicker: EventEmitter<{}>; | ||
datePicker: any; | ||
constructor(input: ElementRef, config: DaterangepickerConfig); | ||
@@ -17,0 +18,0 @@ ngAfterViewInit(): void; |
@@ -34,2 +34,3 @@ "use strict"; | ||
$(this.input.nativeElement).daterangepicker(targetOptions, this.callback.bind(this)); | ||
this.datePicker = $(this.input.nativeElement).data('daterangepicker'); | ||
$(this.input.nativeElement).on('cancel.daterangepicker', function (e, picker) { | ||
@@ -36,0 +37,0 @@ var event = { event: e, picker: picker }; |
{ | ||
"name": "ng2-daterangepicker", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Angular 2 DaterangePicker component", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -142,2 +142,26 @@ ## ng2-daterangepicker | ||
## Daterangepicker methods | ||
You can programmatically update the `startDate` and `endDate` in the picker using the `setStartDate` and `setEndDate` methods. You can access the Date Range Picker object and its functions and properties through the `datePicker` property of the directive using `@ViewChild`. | ||
``` javascript | ||
import { Component, AfterViewInit, ViewChild } from '@angular/core'; | ||
import { DaterangePickerComponent } from 'ng2-daterangepicker'; | ||
@Component({ | ||
selector:'my-app', | ||
template:'<h3>Component Template</h3>' | ||
}) | ||
export class AppComponent { | ||
@ViewChild(DaterangePickerComponent) | ||
private picker: DaterangePickerComponent; | ||
public updateDateRange() { | ||
this.picker.datePicker.setStartDate('2017-03-27'); | ||
this.picker.datePicker.setEndDate('2017-04-08'); | ||
} | ||
} | ||
``` | ||
## Using Daterangepicker Events | ||
@@ -144,0 +168,0 @@ |
Sorry, the diff of this file is not supported yet
55127
1.92%718
0.28%238
11.21%