我正在使用离子2.我从检索到的图像位置从firebase和存储localstroage。离子图像src值为空
但我第一次加载我的应用程序的图片src值为null
<ion-header>
<ion-toolbar>
<ion-title *ngIf="currentuser === '7'" class="text-center"><img id="logo" src="./assets/images/logo_black.png" alt="Smart Permises"></ion-title>
<ion-title class="text-center">
<h3>{{Apartmentname}}</h3>
<img id="logo" [src]="logo" alt="Smart Permises" imageViewer/>
</ion-title>
</ion-toolbar>
</ion-header>
我检查localStorage的值。其fine.why图片src值为null。
this.logo=localStorage.getItem('Logo');
console.log(this.logo);
this.Apartmentname=localStorage.getItem('Apartmentname');
console.log(this.Apartmentname);
再次我closedmy app.and打开。它工作正常。
为什么?
感谢
你打电话给这个吗? 'this.logo = localStorage.getItem( '标志');'。生命周期事件? – Sampath
Thanks.I在应用程序component.ts中调用构造函数 – ANISUNDAR
是'app.html'文件中的图像吗? – Sampath