When i am trying to render name in html file is it showing properly but when i am trying to get category_image.thubmail in html, getting Cannot read property 'thumbnail' of undefined error Details are given below
Json data
[
{
"id": 22,
"name": "Test Name",
"slug": "test-name-english-news",
"cataegory_image": {
"thumbnail": "thumb Image",
"medium": "medium image"
}
}
]
category model file
export interface ICategory {
id: number;
name: string;
slug: string;
category_image: {
thumbnail: string;
medium: string;
};
}
HTML code
<li *ngFor="let category of categories | async">
{{category.name}}{{category.category_image.thumbnail}}
<!-- <a href="#">test<img src="{{category.category_image.thumbnail}}" width="40" alt="{{category.name}}" /></a> -->
</li>