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”


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


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

displayString: string;
this.displayString = "";

//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