mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
fix(text-input): only update input-has-value onInit
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
import {Component, Directive, Attribute, forwardRef, Host, Optional, ElementRef, Renderer} from 'angular2/core';
|
import {Component, Directive, Attribute, forwardRef, Host, Optional, ElementRef, Renderer} from 'angular2/core';
|
||||||
import {NgIf, NgControl} from 'angular2/common';
|
import {NgIf} from 'angular2/common';
|
||||||
|
|
||||||
import {NavController} from '../nav/nav-controller';
|
import {NavController} from '../nav/nav-controller';
|
||||||
import {Config} from '../../config/config';
|
import {Config} from '../../config/config';
|
||||||
@ -457,7 +457,7 @@ export class TextInput {
|
|||||||
*/
|
*/
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: 'textarea,input[type=text],input[type=password],input[type=number],input[type=search],input[type=email],input[type=url],input[type=tel],input[type=date],input[type=datetime],input[type=datetime-local],input[type=week],input[type=time]',
|
selector: 'textarea,input[type=text],input[type=password],input[type=number],input[type=search],input[type=email],input[type=url],input[type=tel],input[type=date],input[type=datetime],input[type=datetime-local],input[type=week],input[type=time]',
|
||||||
inputs: ['value'],
|
inputs: ['value', 'ngModel'],
|
||||||
host: {
|
host: {
|
||||||
'(focus)': 'focusChange(true)',
|
'(focus)': 'focusChange(true)',
|
||||||
'(blur)': 'focusChange(false)',
|
'(blur)': 'focusChange(false)',
|
||||||
@ -471,7 +471,6 @@ export class TextInputElement {
|
|||||||
elementRef: ElementRef,
|
elementRef: ElementRef,
|
||||||
renderer: Renderer,
|
renderer: Renderer,
|
||||||
@Optional() wrapper: TextInput,
|
@Optional() wrapper: TextInput,
|
||||||
@Optional() ngControl: NgControl
|
|
||||||
) {
|
) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.elementRef = elementRef;
|
this.elementRef = elementRef;
|
||||||
@ -487,13 +486,10 @@ export class TextInputElement {
|
|||||||
wrapper.registerInput(this);
|
wrapper.registerInput(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ngControl) this.ngControl = ngControl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentChecked() {
|
ngOnInit(){
|
||||||
if (this.ngControl) console.log("Value", this.ngControl.value);
|
this.wrapper && this.wrapper.hasValue(this.ngModel);
|
||||||
if (this.ngControl) this.value = this.ngControl.value;
|
|
||||||
this.wrapper && this.wrapper.hasValue(this.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
focusChange(changed) {
|
focusChange(changed) {
|
||||||
|
Reference in New Issue
Block a user