Angular 4+ provides a way to perform if/else logic in the template file, e.g.
<ng-container *ngIf="isSaveSuccess; else elseBlock">
Save succeeded.
</ng-container>
<ng-template #elseBlock>
Save failed.
</ng-template>
This, however, requires that you specify a unique ng-template id. We have some concern about accidentally introducing duplicate "elseBlock" templates with this approach, e.g.
<ng-container *ngIf="isSaveSuccess; else elseBlock">
Save succeeded.
</ng-container>
<ng-template #elseBlock>
Save failed.
</ng-template>
...
<ng-container *ngIf="isUpdateSuccess; else elseBlock">
Update succeeded.
</ng-container>
<ng-template #elseBlock> <!-- duplicate id -->
Update failed.
</ng-template>
Is there a way to lint the Angular template files to detect duplicate ng-template ids?