-
-
Notifications
You must be signed in to change notification settings - Fork 295
/
Copy pathmodal-view.ts
32 lines (28 loc) · 1.09 KB
/
modal-view.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Component, OnInit, NgModule } from "@angular/core";
import { ModalDialogParams } from "nativescript-angular";
import { DatePicker } from "ui/date-picker";
import { Page } from "ui/page";
// >> passing-parameters
@Component({
moduleId: module.id,
templateUrl: "./modal-view.html",
})
export class ModalViewComponent implements OnInit {
public currentdate: Date;
constructor(private params: ModalDialogParams, private page: Page) {
this.currentdate = new Date(params.context);
}
ngOnInit() {
let datePicker: DatePicker = <DatePicker>this.page.getViewById<DatePicker>("datePicker");
datePicker.year = this.currentdate.getFullYear();
datePicker.month = this.currentdate.getMonth() + 1;
datePicker.day = this.currentdate.getDate();
datePicker.minDate = new Date(1975, 0, 29);
datePicker.maxDate = new Date(2045, 4, 12);
}
public submit() {
let datePicker: DatePicker = <DatePicker>this.page.getViewById<DatePicker>("datePicker");
this.params.closeCallback(datePicker.date);
}
}
// << passing-parameters