Make condtion if else

i have record, but i want to make condition… if my record is value null then show “Record not found” but if record is value true then “looping data”

Hi,

You can use *ngIf="!value". If the value is null or false, the particular element will display otherwise it will hide.

Thanks
Mani

You may want to deal with that in your component.ts, like so

displayString: string;
 constructor(){
this.displayString = "";
}

ionViewDidLoad(){
//code to get your record's value
//once you have your result / record

record === true ? this.displayString = 'looping data' : this.displayString = 'Record not found';

//which is the equivalent of 
if (record === true) {
  this.displayString = 'looping data'; 
  } else {
  this.displayString = 'Record not found';
  }
//whichever you are most comfortable with
 }

In your HTML

<ion-label>{{displayString}}</ion-label>