Code works fine for the first time but gives Runtime Error second time

Hi,

In my Home Page I have two buttons, Search Jobs and Search News.

<ion-buttons style="margin-top: 15px">
		<button ion-button full (click)="showSearchJobs()">Search Jobs</button>
	</ion-buttons>

<ion-buttons style="margin-top: 15px">
		<button ion-button full (click)="showSearchNews()">Search News</button>
	</ion-buttons>

The html of jobs.html page is as follows:

  <ion-list>
  <ion-item *ngFor="let post of PostService.posts" (click)="detailsPage(post)">
   {{post.title}}
  </ion-item>

</ion-list>

The html of the news.html page is as follows:

 <ion-list>
  <ion-item *ngFor="let post of PostService.posts" (click)="detailsJobPage(post)">
    <ion-avatar item-left>
      <img src="{{post.bimg}}">
    </ion-avatar>
    <h2>{{post.title}}</h2>
    <p>{{(post.desc).substring(0,35)}}</p>
  </ion-item>

</ion-list>

My question is, If I click on Search News button before I click Search Jobs the list is displaying properly, but if I click Search Jobs button and then Search News I am getting the below error.

Runtime Error
Error in ./SearchNewsPage class SearchNewsPage - caused by: Cannot read property 'substring' of undefined

Thanks.

The error message seems pretty clear to me: whatever is responsible for populating post is not putting something with a defined desc property in it.

Thanks @rapropos.
Yes the error is clear, but it happens only when I click on Search Jobs and then Search News.
But if I click Search News before Search Jobs it’s working perfectly fine.

PS. Object post is same in both the html. Could this be an issue?