I have a question about checking if some field in object exists. I want to print all categories which user has so I\'m doing something like this:
<ul *ngIf=\"user.categories.length > 0\" *ngFor=\"#category of user.categories\">
<li>
{{category.name}}
</li>
</ul>
The reason? All the data are PROPERLY printed but I\'m getting an error in web console like:
Cannot read property \'name\' of null
But when I do something like:
<ul *ngIf=\"user.categories.length > 0\" *ngFor=\"#category of user.categories\">
<li *ngIf=\"category\">
{{category.name}}
</li>
</ul>
Then all is okay. Am I doing something wrong or maybe I have to check this every time? Have you ever a problem like this one? Thanks in advance.