Angular: Print Null from an asynchronous data that contains null


I am fetching the data from backend (Node.js/Express.js + Oracledb) which contains some null values. I want to print Null in the table in HTML where the data contains null. Is there a way that I can do that?

My code:


<div class="table-responsive">
  <table style = "text-align: center; margin: auto;">
        Company Code
        Company Name
        Company Sub Mode
        Short Details
    <tbody *ngFor = "let compData of companyData">
        <td>{{compData[0][1]}}</td> //here I want to print Null if the value from the backend contains null


  const params = new HttpParams().set('id', test)

  this.http.get<{[key: string] : Corporate}> 
  ('http://localhost:3000/api/searchCompany', {params})
  .pipe(map(responseData => {
      const postsArray : Corporate [] = [];

      for(const key in responseData)
          postsArray.push({...responseData[key], idkey: key});
      return postsArray;
  .subscribe(posts => {

    this.companyData = posts;
,error => {
  console.log("Error occurred while searching the company " + error.message);




if you get null from compData[0][1]

then you can try

{{compData && compData[0] && compData[0][1] ? compData[0][1] : 'Null'}}

Answered By – mr. pc_coder

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.