add tags functionality

This commit is contained in:
Jan-Marlon Leibl 2024-11-26 09:51:53 +01:00
parent dd4faea712
commit 074da034c5
2 changed files with 31 additions and 5 deletions

View file

@ -46,6 +46,20 @@
<div *ngIf="form.get('rating')?.errors?.['max']">Hotel Rating cannot be more than 5.</div>
</div>
</div>
<div class="form-group">
<label for="hotelTags" class="block text-sm font-medium text-gray-700">Hotel Tags</label>
<div formArrayName="tags">
<div *ngFor="let tag of tags.controls; let i=index" class="flex items-center space-x-2">
<input type="text" [formControlName]="i"
class="form-control mt-1 w-full p-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200"
[id]="'hotelTag' + i" placeholder="Enter hotel tag">
<button mat-icon-button (click)="tags.removeAt(i)" class="mt-1">
<mat-icon class="text-red-500">delete</mat-icon>
</button>
</div>
<button type="button" mat-stroked-button (click)="addTag()" class="mt-2">Add Tag</button>
</div>
</div>
<div class="flex justify-between">
<div class="flex space-x-1">
<button type="submit" mat-flat-button (click)="submit()">Submit</button>