Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. <div class="container">
  2. <h1>Add Product Demo</h1>
  3. <form [formGroup]="myForm" (ngSubmit)="onSubmit()">
  4. <div class="form-group">
  5. <label for="Id">p_id</label>
  6. <input formControlName="p_id" type="number" id="p_id" class="form-control">
  7. </div>
  8. <div class="alert alert-danger" *ngIf="myForm.get('p_id').hasError('required') && myForm.get('p_id').touched">
  9. p_id is required
  10. </div>
  11. <div class="form-group">
  12. <label for="pname">pname</label>
  13. <input formControlName="pname" type="text" id="pname" class="form-control">
  14. </div>
  15. <div class="alert alert-danger" *ngIf="(myForm.get('pname').hasError('required') || myForm.get('pname').invalid ) && myForm.get('pname').touched ">
  16. product name is required and it shouldn't be Example
  17. </div>
  18. <div class="form-group">
  19. <label for="pprice">pprice</label>
  20. <input formControlName="pprice" type="text" id="pprice" class="form-control">
  21. </div>
  22. <div class="alert alert-danger" *ngIf="(myForm.get('pprice').hasError('required') || myForm.get('pprice').invalid) && myForm.get('pprice').touched">
  23. pprice is required and must be positive value
  24. </div>
  25. <div class="form-group">
  26. <label for="pimg">pimg</label>
  27. <input formControlName="pimg" type="text" id="pimg" class="form-control">
  28. </div>
  29. <div class="alert alert-danger" *ngIf="myForm.get('pimg').hasError('required') && myForm.get('pimg').touched">
  30. pimg is required
  31. </div>
  32. <div class="form-group">
  33. <label for="soh">soh</label>
  34. <input formControlName="soh" type="text" id="soh" class="form-control">
  35. </div>
  36. <div class="alert alert-danger" *ngIf="(myForm.get('soh').hasError('required') || myForm.get('soh').invalid) && myForm.get('soh').touched">
  37. soh is required and maximum soh would be 10
  38. </div>
  39. <button type="submit" [disabled]="!myForm.valid" class="btn btn-primary">Add Product</button>
  40.  
  41. </form>
  42. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement