I am getting json object from the server and they are deep nested.
Anyway, I want to show 'The user hasn't filled in yet' when the json object is empty (or array)
I tried almost everything but they didn't work. What am I doing wrong?
<div class="common-container" *ngFor="let detail of deepTeaInfo | getValues">
<div id="exp-box" *ngFor="let grade of detail['introduceInfo']['grade'] | getValues">
<p class="fontstyle3">Grade: <span class="fontstyle2">{{grade.category | type_transform}}</span></p>
<p class="fontstyle3">Period: <span class="fontstyle2"> {{grade.when | type_transform}}</span></p>
<p class="fontstyle3">Description: <span class="fontstyle2"> {{grade.description}}</span> </p>
<p class="fontstyle2" *ngIf="grade?.length > 0">
The user hasn't filled in yet
</p>
</div>
<br>
</div>
The things I've tried
*ngIf="grade?.length > 0"
*ngIf = "(grade|json) == '{}'"
*ngIf = "grade.length >0"
*ngIf = "(grade|json).length >0"
*ngIf "(grade|json) == ({}|json)"
they didn't work.
If I {{grade.json}} in the html, I see something like
{when: 2011, description: temp, category: school},
{when: 2011, description: temp, category: school}
If I {{grade}} in the html, I see
[object Object]
[object Object]
(I know that the array is empty seeing from the json string that I got from the server :))
What am I doing wrong?