title: NativeScript / Angular Page.getViewById returns 'undefined'
body: <p>I'm working on a NativeScript/Angular app. I am new to NativeScript and following a tutorial based on an earlier version (mine is 4.1.0, not sure what they're using). There's a modal dialog with a DatePicker element. I would like it to return the selected date to the parent element. The app compiles and launches just fine. But when I try to open the modal, I get the error, "Cannot set property 'year' of undefined". </p>
  
  <p>The HTML is as follows:</p>
  
  <pre><code>&lt;StackLayout class="modal-view-style"&gt;
    &lt;StackLayout&gt;
      &lt;DatePicker id="datePicker"&gt;&lt;/DatePicker&gt;
    &lt;/StackLayout&gt;
    &lt;Button class="btn btn-primary btn-active" text="submit" (tap)="submit()"&gt;&lt;/Button&gt;
  &lt;/StackLayout&gt;
  </code></pre>
  
  <p>And here's the class:</p>
  
  <pre><code>import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
  import { ModalDialogParams } from 'nativescript-angular/modal-dialog';
  import { DatePicker } from 'tns-core-modules/ui/date-picker';
  import { Page } from 'tns-core-modules/ui/page';
  
  @Component({
    moduleId: module.id,
    templateUrl: './date-picker-modal.component.html'
  })
  export class DatePickerModalComponent implements OnInit {
  
    constructor(private params: ModalDialogParams, private page: Page) { }
  
    ngOnInit() { 
      let datePicker: DatePicker = &lt;DatePicker&gt;this.page.getViewById&lt;DatePicker&gt;('datePicker');
  
        let currentdate: Date = new Date();
        datePicker.year = currentdate.getFullYear();
        datePicker.month = currentdate.getMonth() + 1;
        datePicker.day = currentdate.getDate();
        datePicker.minDate = currentdate;
        datePicker.maxDate = new Date(2045, 4, 12);
    }
  
    public submit() {
        let datePicker: DatePicker = &lt;DatePicker&gt;this.page.getViewById&lt;DatePicker&gt;('datePicker');
        let selectedDate = datePicker.date;
  
        let reserveTime = new Date(
          selectedDate.getFullYear(),
          selectedDate.getMonth(),
          selectedDate.getDate()
        ));
        this.params.closeCallback(reserveTime.toISOString());
    }
  
  }
  </code></pre>
  
  <p>Does anyone know what's going on? I'm assuming it's just that the api has changed, but I haven't been able to find it in the documentation. If I'm right about that, a link to the appropriate place in the docs would be much appreciated. Also, if this is not the "preferred" way to do this sort of thing, I would love to know what is. Thanks.</p>