Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. <div class="book-edit">
  2. <div class="row">
  3. <div class="col">
  4. <h2 class="h2">{{ title }}</h2>
  5. <form name="form" (ngSubmit)="f.form.valid && onSave()" #f="ngForm" novalidate>
  6. <div class="form-group">
  7. <label for="name">Name</label>
  8. <input required type="text" name="name" class="form-control"
  9. [(ngModel)]="model.name" #name="ngModel" [ngClass]="{ 'is-invalid': f.submitted && genre.invalid }">
  10. <div *ngIf="f.submitted && name.invalid" class="invalid-feedback">
  11. <div *ngIf="name.errors.required">Book Name is required</div>
  12. </div>
  13. </div>
  14. <div class="form-group">
  15. <label for="genre">Genre</label>
  16. <input required type="text" name="genre" class="form-control"
  17. [(ngModel)]="model.genre" #genre="ngModel" [ngClass]="{ 'is-invalid': f.submitted && genre.invalid }">
  18. <div *ngIf="f.submitted && genre.invalid" class="invalid-feedback">
  19. <div *ngIf="genre.errors.required">Book Genre is required</div>
  20. </div>
  21. </div>
  22. <div class="form-group">
  23. <label for="author">Author</label>
  24. <select required class="form-control" name="authorId"
  25. [(ngModel)]="model.authorId" #authorId="ngModel" [ngClass]="{ 'is-invalid': f.submitted && authorId.invalid }">
  26. <option value="">Please select an Author</option>
  27. <option *ngFor="let author of authors" [value]="author.id">
  28. {{ author.name }}
  29. </option>
  30. </select>
  31. <div *ngIf="f.submitted && authorId.invalid" class="invalid-feedback">
  32. <div *ngIf="authorId.errors.required">Author is required</div>
  33. </div>
  34. </div>
  35. <div class="form-group">
  36. <div class="controls">
  37. <div class="reset">
  38. <button class="btn btn-warning" type="reset">Reset</button>
  39. </div>
  40. <div class="manage">
  41. <button class="btn btn-danger" [disabled]="!enableDelete()" (click)="delete()">Delete</button>
  42. <button type="submit" class="btn btn-primary">Save</button>
  43. </div>
  44. </div>
  45. </div>
  46. </form>
  47. <pre>{{f.value | json}}</pre>
  48. </div>
  49. </div>
  50. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement