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 {{mainClass || 'row'}}" [ngClass]="{ 'has-danger': control.touched && control.invalid, 'has-success': control.valid, 'has-warning': !authInput && control.untouched && control.invalid }"> | |
<ng-content select="label"></ng-content> | |
<div [class]="divClass"> | |
<ng-content select="[formControlName]"></ng-content> | |
<div class="form-text text-muted" *ngIf="errorMessage">{{errorMessage}}</div> | |
</div> | |
</div> |
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
import { Directive, ElementRef, HostListener, Input, OnInit, Renderer } from '@angular/core'; | |
import { AbstractControl } from '@angular/forms'; | |
const dangerClass: string = 'form-control-danger'; | |
const successClass: string = 'form-control-success'; | |
const warningClass: string = 'form-control-warning'; | |
const classes: string[] = [dangerClass, successClass, warningClass]; | |
@Directive({ | |
selector: '[inputClass]' |