Skip to content

Commit

Permalink
fix(input): add form validation classes to the item
Browse files Browse the repository at this point in the history
references #6040
  • Loading branch information
brandyscarney committed May 21, 2016
1 parent 01110af commit 5498a36
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/components/input/input-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class InputBase {

if (ngControl) {
ngControl.valueAccessor = this;
this.inputControl = ngControl;
}

_form.register(this);
Expand Down Expand Up @@ -107,15 +108,15 @@ export class InputBase {

private setItemControlCss() {
let item = this._item;
let nativeControl = this._native && this._native.ngControl;

if (item && nativeControl) {
item.setCssClass('ng-untouched', nativeControl.untouched);
item.setCssClass('ng-touched', nativeControl.touched);
item.setCssClass('ng-pristine', nativeControl.pristine);
item.setCssClass('ng-dirty', nativeControl.dirty);
item.setCssClass('ng-valid', nativeControl.valid);
item.setCssClass('ng-invalid', !nativeControl.valid);
let inputControl = this.inputControl;

if (item && inputControl) {
item.setCssClass('ng-untouched', inputControl.untouched);
item.setCssClass('ng-touched', inputControl.touched);
item.setCssClass('ng-pristine', inputControl.pristine);
item.setCssClass('ng-dirty', inputControl.dirty);
item.setCssClass('ng-valid', inputControl.valid);
item.setCssClass('ng-invalid', !inputControl.valid);
}
}

Expand Down Expand Up @@ -220,7 +221,7 @@ export class InputBase {
}
nativeInputEle.setAttribute('autocomplete', this._autoComplete);

// by default set autocomplete="off" unless specified by the input
// by default set autocorrect="off" unless specified by the input
if (ionInputEle.hasAttribute('autocorrect')) {
this._autoCorrect = ionInputEle.getAttribute('autocorrect');
}
Expand Down

0 comments on commit 5498a36

Please sign in to comment.