How to set visibility of ionic-card? -
in project use native storage
this.platform.ready().then((readysource) => { console.log('platform ready from', readysource); this.nativestorage.getitem('arrivaldetails') .then( data =>{ //alert(json.stringify(data.arrivaltime)); this.getflightdetails(data.fligtdetails,data.arrivaltime,data.departuretime); }, error => console.error(error) ); });
and want check native storage null or not. if null, want hide ion-card , display text view , if not null want display ion-card , hide text view
<ion-card"> <ion-card-content> <p><span>{{fulldetails.departureairportfscode}}</span></p> </ion-card-content>
you can use additional variable check if empty or not.
let showdata: boolean = false;
and function should looks like
this.platform.ready().then((readysource) => { console.log('platform ready from', readysource); this.nativestorage.getitem('arrivaldetails') .then(data => { if (data){ this.showdata = true; this.getflightdetails(data.fligtdetails,data.arrivaltime,data.departuretime); } else this.showdata = false; },error => { console.error(error); }); });
then in html can use:
<ion-card *ngif="showdata"> <ion-card-content> <p><span>{{fulldetails.departureairportfscode}}</span></p> </ion-card-content> </ion-card> <div *ngif="!showdata"> text here </div>
i hope helps.
Comments
Post a Comment