title: how to fixed this ERROR TypeError: Cannot read properties of undefined (reading 'length') in angular
body: <p>Why is the categoryJobLists.length given the error <strong>ERROR TypeError: Cannot read properties of undefined (reading 'length')</strong></p>
  <pre><code>&lt;ion-content&gt;
  
    &lt;div *ngIf=&quot;categoryJobLists &amp;&amp; categoryJobLists.length &gt; 0&quot;&gt;
      &lt;ion-grid&gt;
        &lt;ion-row *ngFor=&quot;let categorysJobs of categoryJobLists&quot;&gt;
          &lt;ion-col size=&quot;6&quot; (click)=&quot;openJobDetailPage(categoryJobLists)&quot;&gt;
            &lt;ion-card&gt;
              &lt;ion-card-header&gt;
                &lt;ion-card-title&gt; {{categorysJobs.job_title}} &lt;/ion-card-title&gt;
                &lt;ion-card-subtitle&gt;Total Opening:  {{categorysJobs.total_vacancies}} &lt;/ion-card-subtitle&gt;
              &lt;/ion-card-header&gt;
            
              &lt;ion-card-content&gt;
                Open from  {{categorysJobs.apply_from_date}}
              &lt;/ion-card-content&gt;
            &lt;/ion-card&gt;
          &lt;/ion-col&gt;
        &lt;/ion-row&gt;
      &lt;/ion-grid&gt;
    &lt;/div&gt;
  
    &lt;div *ngIf=&quot;categoryJobLists &amp;&amp; categoryJobLists.length == 0&quot;&gt;
      &lt;ion-chip&gt;
        &lt;ion-icon name=&quot;close-circle-outline&quot;&gt;&lt;/ion-icon&gt;
        &lt;ion-label&gt;Not Found&lt;/ion-label&gt;
      &lt;/ion-chip&gt;
    &lt;/div&gt;
    
  &lt;/ion-content&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/JIhWe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JIhWe.png" alt="Please see this attach Image " /></a></p>