Skip to content

Commit

Permalink
release: 2.1.6-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hsuanxyz committed Jan 23, 2018
1 parent 0f6e693 commit fa47bc4
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 5 deletions.
4 changes: 2 additions & 2 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"ion2-calendar": "^2.1.5",
"ion2-calendar": "^2.1.6-beta.1",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
Expand Down Expand Up @@ -61,4 +61,4 @@
"ionic-plugin-keyboard": {}
}
}
}
}
67 changes: 67 additions & 0 deletions demo/src/demos/demo-methods.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { Component, ViewChild } from '@angular/core';
import { ToastController } from 'ionic-angular';

import {
CalendarComponent,
CalendarComponentOptions
} from 'ion2-calendar'

@Component({
selector: 'demo-methods',
template: `
<hr>
<h3 style="text-align: center;">methods</h3>
<button ion-button (click)="getCalendarViewDate()">get view date</button>
<button ion-button (click)="serCalendarViewDate()">set view date: 2018-2-1</button>
<ion-calendar #calendar
[(ngModel)]="date"
(onChange)="onChange($event)"
[options]="options"
type="string"
format="YYYY-MM-DD">
</ion-calendar>
`
})
export class DemoMethodsComponent {

@ViewChild('calendar', { read: CalendarComponent }) calendarRef: CalendarComponent;

date: {
from: string
to: string
} = {
from: '2018-01-15',
to: '2018-01-25'
};
options: CalendarComponentOptions = {
from: new Date(2000, 0, 1),
pickMode: 'range'
};

constructor(private toastCtrl: ToastController) {

}

_toastWrap(event: string, payload: {}) {
let toast = this.toastCtrl.create({
message: `${event}: ${JSON.stringify(payload, null, 2)}`,
duration: 2000,
});
toast.present()
}

onChange($event) {
console.log('onChange', $event);
}

getCalendarViewDate() {
console.log(this.calendarRef)
this._toastWrap('view date', this.calendarRef.getViewDate());
console.log('view date', this.calendarRef.getViewDate())
}

serCalendarViewDate() {
this.calendarRef.setViewDate('2018-02-01')
}

}
4 changes: 3 additions & 1 deletion demo/src/demos/demos.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { DemoMultiComponent } from "./demo-multi";
import { DemoRangeComponent } from "./demo-range";
import { DemoOptionsComponent } from "./demo-options";
import { DemoEventsComponent } from "./demo-events";
import { DemoMethodsComponent } from "./demo-methods";

const COMPONENTS = [
DemoModalBasicComponent,
Expand All @@ -30,7 +31,8 @@ const COMPONENTS = [
DemoMultiComponent,
DemoRangeComponent,
DemoOptionsComponent,
DemoEventsComponent
DemoEventsComponent,
DemoMethodsComponent
];

@NgModule({
Expand Down
3 changes: 2 additions & 1 deletion demo/src/pages/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ <h2>component mode</h2>
<demo-basic></demo-basic>
<demo-multi></demo-multi>
<demo-range></demo-range>
<demo-events></demo-events>
<demo-options></demo-options>
<demo-events></demo-events>
<demo-methods></demo-methods>
</ion-content>

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ion2-calendar",
"version": "2.1.5",
"version": "2.1.6-beta.1",
"description": "A date picker component for ionic2 ",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
Expand Down

0 comments on commit fa47bc4

Please sign in to comment.