title: how to close ng-pick-datetime picker manually in angular 6?
body: <p>I am using ng-pick-datetime picker as a dialog mode. It is working fine but If I open it and moved to other route without closing it my application gets hang. So Please suggest me how to close the picker before moving to another path. I tried to get accessibility using ViewChild but it doesn't work.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button type="button" class="list-group-item list-group-item-action" [ngClass]="{'active': selectedItem == devices.name}" [owlDateTimeTrigger]="dt5"&gt;
                          &lt;!-- [ngClass]="status ? 'active' : 'light'" --&gt;
                          {{devices.name}}
                          &lt;!-- To show datetime picker --&gt;
                          &lt;input [owlDateTime]="dt5" [(ngModel)]="selectedDateTime" class="hideInput" [min]="minDate" [max]="maxDate"
                          (dateTimeInput)="getHistory(devices.imei_no,devices.remaining_days_to_expire,devices.name)"&gt;
                          &lt;owl-date-time [pickerMode]="'dialog'" #dt5&gt;&lt;/owl-date-time&gt;                         
                      &lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <pre><code>@ViewChild('dt5') calendarView: ElementRef;
  
  ngOnDestroy(): void {
    this.calendarView.nativeElement.visibility = 'hidden' //throwing error cannot set property of undefined element
  }
  </code></pre>