Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rakia/4305cc1fb23a748ef9d7104a09a952b2 to your computer and use it in GitHub Desktop.
Save rakia/4305cc1fb23a748ef9d7104a09a952b2 to your computer and use it in GitHub Desktop.
Angular: Logic to show real-time feedback to users when they type a name that already exists in the system
<ng-container *ngIf="isCreateMode">
<div class="mt-0">
<app-create-custom-field
[ecsFieldset]="entity.id!"
[nameAlreadyExists]="nameAlreadyExists"
(checkIfNameExists)="checkIfNameExists.emit($event)"
(cancelEdit)="cancelEdit.emit()"
(save)="createCustomField.emit($event)"
>
</app-create-custom-field>
</div>
</ng-container>
<ng-container *ngIf="!openAllFields && selectedEcsField?.id">
<div class="mt-2">
<app-ecs-field
[entity]="selectedEcsField!"
[nameAlreadyExists]="nameAlreadyExists"
(checkIfNameExists)="checkIfNameExists.emit($event)"
(cancelEdit)="cancelEdit.emit()"
(delete)="deleteEcsField.emit($event)"
>
</app-ecs-field>
</div>
</ng-container>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment