@obednoe22 wrote:
When I install file transfer I can not use it without the “/ ngx” and when I import it it throws me an error, here my code
import {Component} from '@angular/core'; import {IonicPage, LoadingController, NavController, NavParams} from 'ionic-angular'; import {MemesProvider} from "../../providers/memes/memes"; import {NuevoComentarioPage} from "../nuevo-comentario/nuevo-comentario"; import {FileTransfer} from "@ionic-native/file-transfer/ngx"; import { File } from '@ionic-native/file/ngx'; /** * Generated class for the VerMemePage page. * * See https://ionicframework.com/docs/components/#navigation for more info on * Ionic pages and navigation. */ @IonicPage() @Component({ selector: 'page-ver-meme', templateUrl: 'ver-meme.html', }) export class VerMemePage { id: any; ruta:any= ""; meme: any = { titulo: "", promedio: "", descripcion: "", ruta: "" }; comentarios = []; constructor(public navCtrl: NavController, public navParams: NavParams, private memeProv: MemesProvider, private loadingCtrl: LoadingController,private transfer:FileTransfer, private file: File) { this.id = this.navParams.get('id'); } ionViewDidEnter() { this.getMeme(); } //TODO ngif para evitar comentarios del creador getMeme() { const loader = this.loadingCtrl.create({ content: "Cargando meme..." }); loader.present(); this.memeProv.verMeme(this.id).subscribe((result) => { this.meme = result; this.ruta = "https://memeappapi.herokuapp.com/memes/" + result.ruta; this.meme.ruta = result.ruta; loader.dismiss(); }); const loadera = this.loadingCtrl.create({ content: "Cargando comentarios..." }); loadera.present(); this.memeProv.comentariosM(this.id).subscribe((result) => { this.comentarios = result.comentarios; loadera.dismiss(); }) } descargar(ruta) { const fileTransfer: FileTransferObject = this.transfer.create(); /*fileTransfer.download(this.ruta, this.file.dataDirectory + ruta + '.png').then((entry) => { console.log('download complete: ' + entry.toURL()); }, (error) => { // handle error });*/ } nuevo() { this.navCtrl.push(NuevoComentarioPage, { id: this.id }); } }
and my info system
Ionic:
ionic (Ionic CLI) : 4.4.0 (C:\Users\obedn\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.5
@ionic/app-scripts : 3.2.3Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, (and 6 other plugins)System:
NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
The error isERROR TypeError: Cannot read property ‘constructor’ of undefined
Posts: 1
Participants: 1