mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
fix(inputs): fix form onChange/onTouch
This commit is contained in:
@ -55,9 +55,6 @@ export class Checkbox {
|
||||
) {
|
||||
_form.register(this);
|
||||
|
||||
this.onChange = (_) => {};
|
||||
this.onTouched = (_) => {};
|
||||
|
||||
if (ngControl) {
|
||||
ngControl.valueAccessor = this;
|
||||
}
|
||||
@ -114,6 +111,20 @@ export class Checkbox {
|
||||
this.checked = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
onChange(val) {
|
||||
// TODO: figure the whys and the becauses
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
onTouched(val) {
|
||||
// TODO: figure the whys and the becauses
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Angular2 Forms API method called by the view (NgControl) to register the
|
||||
|
@ -55,7 +55,9 @@ export class RadioButton {
|
||||
private _form: Form,
|
||||
private _renderer: Renderer,
|
||||
private _elementRef: ElementRef
|
||||
) {}
|
||||
) {
|
||||
_form.register(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
@ -88,6 +90,13 @@ export class RadioButton {
|
||||
public set isChecked(isChecked) {
|
||||
this._renderer.setElementAttribute(this._elementRef, 'aria-checked', isChecked);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ngOnDestroy() {
|
||||
this._form.deregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -184,8 +193,19 @@ export class RadioGroup {
|
||||
}
|
||||
}
|
||||
|
||||
public onChange = (_:any) => {};
|
||||
public onTouched = () => {};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
onChange(val) {
|
||||
// TODO: figure the whys and the becauses
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
onTouched(val) {
|
||||
// TODO: figure the whys and the becauses
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
@ -91,9 +91,6 @@ export class Toggle {
|
||||
this.lastTouch = 0;
|
||||
this.mode = config.get('mode');
|
||||
|
||||
this.onChange = (_) => {};
|
||||
this.onTouched = (_) => {};
|
||||
|
||||
if (ngControl) {
|
||||
ngControl.valueAccessor = this;
|
||||
}
|
||||
@ -164,13 +161,6 @@ export class Toggle {
|
||||
this.onChange(this._checked);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
writeValue(value) {
|
||||
this.checked = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@ -209,6 +199,27 @@ export class Toggle {
|
||||
this.isActivated = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
writeValue(value) {
|
||||
this.checked = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
onChange(val) {
|
||||
// TODO: figure the whys and the becauses
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
onTouched(val) {
|
||||
// TODO: figure the whys and the becauses
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@ -225,7 +236,7 @@ export class Toggle {
|
||||
ngOnDestroy() {
|
||||
this.removeMoveListener();
|
||||
this.toggleEle = this.addMoveListener = this.removeMoveListener = null;
|
||||
this.form.deregister(this);
|
||||
this._form.deregister(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user