Last active
February 3, 2016 04:35
-
-
Save qdouble/e7449d0b454b59594264 to your computer and use it in GitHub Desktop.
Input Html
This file contains 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
<div class="form-group" [class.has-warning]="!myControl.valid && myControl.touched"> | |
<label *ngIf="type !== 'checkbox'">{{label}}</label> | |
<input *ngIf="type === 'text'" [type]=type class="form-control" | |
[(ngFormControl)]=myControl [requiredVal]=required | |
[patternValidator]="pattern" [focusOn]=focusOn | |
> | |
<input *ngIf="type === 'number'" [type]=type class="form-control" | |
[(ngFormControl)]=myControl [requiredVal]=required | |
[min]=min [max]=max [focusOn]=focusOn | |
> | |
<input *ngIf="type === 'checkbox'" type=checkbox | |
[(ngFormControl)]=myControl [requiredVal]=required | |
> | |
<label *ngIf="type === 'checkbox'">{{label}}</label> | |
<span class="ng-messages" [hidden]="myControl.valid"> | |
<p class="text-help small" *ngIf="myControl.errors?.required">Required field</p> | |
<p class="text-help small" *ngIf="myControl.errors?.invalidPattern">{{label}} is invalid</p> | |
<p class="text-help small" *ngIf="myControl.errors?.min">The mininim value for {{label}} is {{min}}</p> | |
<p class="text-help small" *ngIf="myControl.errors?.max">The maximum value for {{label}} is {{max}}</p> | |
</span> | |
</div> | |
<p *ngIf="details" class="text-help small">{{details}}</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment