Last active
September 20, 2017 08:21
-
-
Save molcik/322615528287e92669621c593663db0b to your computer and use it in GitHub Desktop.
hero-detail.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<form [formGroup]="heroForm" (ngSubmit)="onSubmit()" novalidate> | |
<div style="margin-bottom: 1em"> | |
<button type="submit" | |
[disabled]="heroForm.pristine || name.invalid" class="btn btn-success">Save</button> | |
<button type="reset" (click)="revert()" | |
[disabled]="heroForm.pristine" class="btn btn-danger">Clear</button> | |
</div> | |
<!-- Hero Detail Controls --> | |
<div class="form-group"> | |
<label class="center-block">Name: | |
<input id="name" class="form-control" formControlName="name" required > | |
</label> | |
<div *ngIf="name.invalid && (name.dirty || name.touched)" | |
class="alert alert-danger"> | |
<div *ngIf="name.errors.required"> | |
Name is required. | |
</div> | |
<div *ngIf="name.errors.minlength"> | |
Name must be at least 4 characters long. | |
</div> | |
</div> | |
</div> | |
... | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment