Bonjour,

je developpe une application mobile en utilisant inonic 3 et j'ai eu une erreur que j'ai cherché longtemps mais pas de solution.
A cet effet j'expose mon probleme pour trouver une solution ensemble, alors les fichiers consernés sont les suivants:

<---------------page service----------------------------->
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
import {Injectable} from "@angular/core";
import {EnginVole} from "../model/enginVoles";
import {Storage} from "@ionic/storage";

@Injectable()
export class EnginVolesService {
  constructor(public storage:Storage){}

  private enginVoles: Array<EnginVole> = [
    {numPlaque: "18 M 147 A"}, {numPlaque: "18 M 187 C"},
    {numPlaque: "18 M 789 J"}
    ];

  addEnginVole(enginVole:EnginVole) {
    this.enginVoles.push(enginVole);
    this.storage.set('enginVoles',this.enginVoles);

  }

  getAllEnginVole() {
    return this.storage.get('enginVoles').then(data => {
      this.storage = data != null ? data : [];
      return this.enginVoles;
    })

  }
}
*/
import {Storage} from "@ionic/storage";
import {EnginVole} from "../model/enginVoles";
import {Injectable} from "@angular/core";

@Injectable()
export  class  EnginVolesService {
  constructor(public storage:Storage){}
  private enginVoles:Array<EnginVole>=[
    {numPlaque: "18 M 147 A"}, {numPlaque: "18 M 187 C"},
    {numPlaque: "18 M 789 J"}
  ];
  addEnginVole(enginVole:EnginVole){
    this.enginVoles.push(enginVole);
    this.storage.set('enginVoles',this.enginVoles);
  }
  getAllEnginVole(){
    return this.storage.get('enginVoles').then(data=>{
      this.storage=data!=null?data:[];
      return this.enginVoles;
    });
  }

}
<


<---------------------------------model------------------------------->
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
export class EnginVole{
  numPlaque:string;
  numChassis?:string;
  marque?:string;
  dateVol?:Date;
  nomProprietaire?:string;
  telephonePro?:number;
  lieuVol?:string;
  causeVol?:string;
  timestamp?:number;
}
<---------------------------------------page ts ----------------------------------------->

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
33
34
35
36
37
38
39
40
41
42
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {EnginVole} from "../../model/enginVoles";
import {EnginVolesService} from "../../services/enginVoles.service";
import {NewEnginVolePage} from "../new-engin-vole/new-engin-vole";

/**
 * Generated class for the EnginVolePage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-engin-vole',
  templateUrl: 'engin-vole.html',
})
export class EnginVolePage {
  enginVoles:Array<EnginVole>

  constructor(public navCtrl: NavController, public navParams: NavParams,
              public enginVoleService:EnginVolesService) {
  }

  ionViewWillEnter(){
    //this.enginVoleService.getAllEnginVole().then( data=>{this.enginVoles=data;
    //});
    this.enginVoleService.getAllEnginVole().then(data=>{
      this.enginVoles=data;
    });
  }


  ionViewDidLoad() {
    console.log('ionViewDidLoad EnginVolePage');
  }
  onNewEnginVole(){
    this.navCtrl.push(NewEnginVolePage);
  }

}
<-------------------------------page html---------------------------------------->
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
33
<!--
  Generated template for the UtilisateursPage page.

  See http://ionicframework.com/docs/components/#navigation for more info on
  Ionic pages and navigation.
-->
<ion-header color="danger">

  <ion-navbar color="danger">
    <ion-title>Engin volés</ion-title>
    <button ion-button="" menuToggle="">
      <ion-icon name="menu"></ion-icon>
    </button>
    <ion-buttons end="">
      <button ion-button="" icon-only="" (click)="onNewEnginVole()">
        <ion-icon name="add-circle"></ion-icon>

      </button>
    </ion-buttons>
  </ion-navbar>

</ion-header>


<ion-content padding>
  <ion-list>
    <ion-item *ngFor=" let ev of enginVoles" (click)="onDetailEnginVole(ev)">
      {{ev.numPlaque}}

    </ion-item>

  </ion-list>
</ion-content>

<----------------------------message d"erreur------------------------------------------->
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
NewEnginVolePage.html:23 ERROR TypeError: this.storage.set is not a function
    at EnginVolesService.webpackJsonp.119.EnginVolesService.addEnginVole (enginVoles.service.ts:43)
    at NewEnginVolePage.webpackJsonp.168.NewEnginVolePage.onAddEnginVole (new-engin-vole.ts:30)
    at Object.eval [as handleEvent] (NewEnginVolePage.html:23)
    at handleEvent (core.js:13589)
    at callWithDebugContext (core.js:15098)
    at Object.debugHandleEvent [as handleEvent] (core.js:14685)
    at dispatchEvent (core.js:10004)
    at core.js:12343
    at SafeSubscriber.schedulerFn [as _next] (core.js:4354)
    at SafeSubscriber.__tryOrUnsub (Subscriber.js:242)
je suis bloqué depuis deux jours, s'il vous plait si quelqu'un a une idée va m'aider beaucoup.

cordialement