floating labels

This commit is contained in:
Adam Bradley
2015-09-04 12:37:20 -05:00
parent b44c46dc59
commit f60084f16e
7 changed files with 120 additions and 4 deletions

View File

@ -57,6 +57,14 @@ export class TextInputElement {
get hasFocus() {
return dom.hasFocus(this.elementRef);
}
/**
* Whether the input has a value.
* @returns {boolean} true if the input has a value, otherwise false.
*/
get hasValue() {
return (this.elementRef.nativeElement.value !== '');
}
}
/**
@ -75,6 +83,7 @@ export class TextInputElement {
'(^touchend)': 'pointerEnd($event)',
'(^mouseup)': 'pointerEnd($event)',
'[class.has-focus]': 'inputHasFocus',
'[class.has-value]': 'inputHasValue',
'[tabIndex]': 'activeTabIndex',
'class': 'item'
}
@ -404,6 +413,10 @@ export class TextInput extends Ion {
return !!this.input && this.input.hasFocus;
}
get inputHasValue() {
return !!this.input && this.input.hasValue;
}
get activeTabIndex() {
this.input.tabIndex = (this.inputHasFocus ? 1000 : -1);
return -1;