Typoskript Error: Cannot find-name 'cordova'

JS:

import {Component} from '@angular/core';
import {NavController, Platform, AlertController} from 'ionic-angular';
import {Transfer, TransferObject} from '@ionic-native/transfer';
import {File} from '@ionic-native/file';



@Component({
  selector: 'page-about',
  templateUrl: 'about.html',
  providers: [Transfer, TransferObject, File]
})
export class AboutPage {

  storageDirectory: string = '';

  constructor(public navCtrl: NavController, public platform: Platform, private transfer: Transfer, private file: File, public alertCtrl: AlertController) {
    this.platform.ready().then(() => {
      //make sure this is on a device, not an emulation (e.g. chrome tools device mode)
      if(!this.platform.is('cordova')) {
        return false;
      }

      if (this.platform.is('ios')) {
        this.storageDirectory = cordova.file.documentsDirectory;
      }
      else if(this.platform.is('android')) {
        this.storageDirectory = cordova.file.externalDataDirectory;
		console.log(this.storageDirectory);
      }
      else {
        //exit otherwise, but you could add further types here e.g. Windows
        return false;
      }
    });
  }
  
   downloadImage() {

    this.platform.ready().then(() => {

      const fileTransfer: TransferObject = this.transfer.create();

      const imageLocation = 'http://html5demos.com/assets/dizzy.mp4';

      fileTransfer.download(imageLocation, this.storageDirectory + 'dizzy.mp4').then((entry) => {
       
	   const alertSuccess = this.alertCtrl.create({
          title: `Download Succeeded!`,
          subTitle: `successfully downloaded to: ${entry.toURL()}`,
          buttons: ['Ok']
        });

        alertSuccess.present();

      }, (error) => {

        const alertFailure = this.alertCtrl.create({
          title: `Download Failed!`,
          subTitle: `was not downloaded. Error code: ${error}`,
          buttons: ['Ok']
        });

        alertFailure.present();

      });

    });

  }


}

Ich bin immer der Fehler im Anhang screenshot., Erhalte ich die Fehlermeldung während der Ausführung von meinem Projekt zu bauen in ionic 2, aber installiert hab ich 'Testungen' mit nachstehenden Befehl

npm install -g typings typings, install dt~cordova --save --global

und versucht, jede mögliche Methode, um entfernen dieser Fehler überprüft cordova plugin wie Datei -, file-transfer, aber immer noch Fehler nicht beheben.

Kann jeder suchen.

Hier angebracht auch den code, ich habe keine Ahnung, wo ich bin zu gehen falsch..

Schreibe einen Kommentar