Hello everyone! First post here. I need to display a QR code in my App. This is not the first time I’m doing this, so I grabbed the code from another app I did a couple of month ago. The code is exactly the same, which is really annoying, because all i get is a broken link icon. The only odd thing I found is MIME says “text/plain”. I’ve checked the folders and QR codes are being generated fine. I’ll post my code here but as I said, it works just fine in my other app.
HTML:
<ion-content padding>
<ion-item>
<img src={{srcQR}} class="center" *ngIf="srcQR" />
</ion-item>
<h3>{{codigo}} y {{srcQR}}</h3>
</ion-content>
Ts:
srcQR:string;
constructor(public navCtrl: NavController,
public navParams: NavParams,
public platform: Platform) {
//Leo los parametros que me enviaron
this.srcQR = this.navParams.data.srcQR.file;
Ts that generates the code and passes the path to img:
export interface codigoQR{
tipoDeQR: string;
file: string;
}
...
obtenerDatos(){
//clear out the previous array contents
this.codigo = "";
// Create the loading indicator
let loader = this.loadingCtrl.create({
content: "Obteniendo información..."
});
//Show the loading indicator
loader.present();
this.ServicefusionappProvider.dataCodigoQr().then(
data => {
//Hide the loading indicator
loader.dismiss();
//Now, populate the array with data from the weather service
if (data) {
this.codigo = data.datos[0].dni;
this.barcode.encode(this.barcode.Encode.TEXT_TYPE, this.codigo).then(data =>
{
this.srcQR = data;
console.log(data);
},
error => {
console.log("Hubo un error: ",error);
});
...
Let me know if there is anything else I can provide