Ionic platform usage

I’m struggling with some unexpected behavior using import { Platform } from '@ionic/angular';

I’m using public in my constructor so that I can access it directly in my template
public platform: Platform

<ion-item *ngIf="!'cordova')" lines="none">
  <ion-label>Select a Photo:</ion-label>

Because on mobile, I’m using the native photo picker.
On mac, iOS and Android this works but on Windows, the ion-item never displays.

The worst part is that I don’t have a windows computer but a my client says the File Input never shows up.
I tried using Microsoft Edge on my Mac and even setup a Virtual Machine with a Dev copy of Windows 10 but it’s a mess won’t boot. I don’t have $150 to spend on a windows license…

Is the code above ok? Can you safely access platform from the template or should I be doing all the JS checking in my component and just expose booleans in my ngIfs?

Can someone with a windows computer check to see if runs properly on windows? (Using Chrome and Edge).

Is there a way I can rent a running windows computer that I can ssh into to run such checks on my own?


My short answer would be “no, and do all the checking in the controller”. The longer answer is probably that you’re asking platform a question before it’s declared itself ready.

@rapropos so this would be better:

  isCordova() {
<ion-item *ngIf="isCordova()" lines="none">

or might I need some setTimeout(() => {}, 0) hackery.

this.platform.ready().then(() =>"cordova"));