samedi 28 mars 2020

Ionic 4 et ion-select event

Lors de l'utilisation de ion-select, l'évènement renvoyer par ionChange() est de type SelectInputChangeEvent.

SelectInputChangeEvent dérive de Event, et contient les bonnes propriétés.
sinon seul sera visible { "isTrusted":true|false }

<ion-select value="selected" (ionChange)="onChangeSelection($event)">
    <ion-select-option *ngFor="let item of items" [value]="item" selected="item===selected">{{item}}</ion-select-option>
</ion-select>
onChangeSelection(event: SelectInputChangeEvent){
  this.selected = event.detail.value;
}

vendredi 1 mars 2019

Ionic file upload issue on iOS

The fileTransfert variable must be initialize in the platform.ready().then() method.


import { FileTransfer } from "@ionic-native/file-transfer";
import { Platform } from 'ionic-angular';

...

private fileTransfer: FileTransferObject;

...

constructor(public transfer: FileTransfer, public platform: Platform) {
    this.platform.ready().then(
     (ready)=>{
       this.fileTransfer= this.transfer.create();
     }
   );
}

Cordova gradle issue

when you change gradle version for example after Android ask you to update it

You have several choices:

  • remove and reinstall android platform. :(
  • define a path to the new gradle with an environment variable :)
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=https://services.gradle.org/distributions/gradle-4.10-all.zip