Skip to content

Commit baf3b78

Browse files
committed
style(book-new): add bootstrap form style
1 parent 719d1d8 commit baf3b78

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed
Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
<h2>Add New Book</h2>
22
<form [formGroup]="form" (ngSubmit)="onSubmit()">
3-
<input type="text" formControlName="title" /><br />
4-
<span [hidden]="!form.get('title').hasError('required')">Title is required</span><br />
5-
<input type="text" formControlName="author" /><br />
6-
<span [hidden]="!form.get('author').hasError('required')">Author is required</span><br />
7-
<button [disabled]="!form.valid">Save</button>
8-
</form>
3+
<div class="form-group row">
4+
<label for="isbn" class="col-sm-2 col-form-label">ISBN</label>
5+
<input class="form-control col-sm-10" type="text" formControlName="isbn" />
6+
<small class="col-sm-10 offset-sm-2" [hidden]="!form.get('isbn').hasError('required')">ISBN is required</small>
7+
<small class="col-sm-10 offset-sm-2" [hidden]="!form.get('isbn').hasError('minlength')">ISBN length should be 13</small>
8+
<small class="col-sm-10 offset-sm-2" [hidden]="!form.get('isbn').hasError('maxlength')">ISBN length should be 13</small>
9+
</div>
10+
<div class="form-group row">
11+
<label for="title" class="col-sm-2 col-form-label">Title</label>
12+
<input type="text" formControlName="title" class="form-control col-sm-10" />
13+
<small class="col-sm-10 offset-sm-2" [hidden]="!form.get('title').hasError('required')">Title is required</small>
14+
</div>
15+
<div class="form-group row">
16+
<label for="author" class="col-sm-2 col-form-label">Author</label>
17+
<input class="form-control col-sm-10" type="text" formControlName="author" />
18+
<small class="col-sm-10 offset-sm-2" [hidden]="!form.get('author').hasError('required')">Author is required</small>
19+
</div>
20+
<div class="row">
21+
<button [disabled]="!form.valid" type="submit" class="btn btn-success offset-sm-2">Create</button>
22+
</div>
23+
</form>

0 commit comments

Comments
 (0)