mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
feat(text-input): added the form ng control status classes to ion-input
references #678
This commit is contained in:
@ -48,7 +48,13 @@ import {Platform} from '../../platform/platform';
|
|||||||
'(touchstart)': 'pointerStart($event)',
|
'(touchstart)': 'pointerStart($event)',
|
||||||
'(touchend)': 'pointerEnd($event)',
|
'(touchend)': 'pointerEnd($event)',
|
||||||
'(mouseup)': 'pointerEnd($event)',
|
'(mouseup)': 'pointerEnd($event)',
|
||||||
'class': 'item'
|
'class': 'item',
|
||||||
|
'[class.ng-untouched]': 'addNgClass("ng-untouched")',
|
||||||
|
'[class.ng-touched]': 'addNgClass("ng-touched")',
|
||||||
|
'[class.ng-pristine]': 'addNgClass("ng-pristine")',
|
||||||
|
'[class.ng-dirty]': 'addNgClass("ng-dirty")',
|
||||||
|
'[class.ng-valid]': 'addNgClass("ng-valid")',
|
||||||
|
'[class.ng-invalid]': 'addNgClass("ng-invalid")'
|
||||||
},
|
},
|
||||||
template:
|
template:
|
||||||
'<div class="item-inner">' +
|
'<div class="item-inner">' +
|
||||||
@ -87,6 +93,14 @@ export class TextInput {
|
|||||||
this.keyboardHeight = config.get('keyboardHeight');
|
this.keyboardHeight = config.get('keyboardHeight');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* This function is used to add the Angular css classes associated with inputs in forms
|
||||||
|
*/
|
||||||
|
addNgClass(className) {
|
||||||
|
return this.input.elementRef.nativeElement.classList.contains(className);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user