I am trying to access the category slug for a product in ionic using the WordPress rest API. This seems to work fine on one page as <h3 class="product-name uppercase">{{productdetail?.categories[0].slug}}</h3>
however this does not seems to work when i try implementing the same using for loop in angular on another page
<div class="width50" *ngFor="let object of dataList">
<img src="{{object.images[0].src}}" width="150" (click)="navigateToPage(object.id)" />
<h3 class="product-name uppercase" text-nowrap>{{object?.categories[0].slug}}</h3>
</div>
it gives an error as v.context.$implicit.categories[0] is undefined
however on same page the code for image source seems to work fine.