If I use an *ngFor
like this:
<ng-container *ngFor="let row of moreInfoData.errorInformationArray; let i = index" >
{{row.ErrorCode}} <br>
</ng-container>
It displays:
Error1
Error2
But I want to check first to see if row.ErrorCode
exists. So I’m trying to use this:
<ng-container *ngFor="let row of moreInfoData.errorInformationArray; let i = index" >
<span *ngIf="row.ErrorCode; else noErrorCode">
{{row.ErrorCode}} <br>
</span>
<ng-template #noErrorCode>N/A</ng-template>
</ng-container>
In this case it displays:
Error1Error2
What am I doing wrong in the second case and how can I get line breaks between the two Error Codes like the first case?
2
Answers
As an option you can do it using unordered list:
And in your styles put this to hide the dots:
Working example: https://stackblitz.com/edit/stackblitz-starters-4xzbvr?file=src%2Fmain.ts