diff --git a/ionic/components/checkbox/checkbox.ts b/ionic/components/checkbox/checkbox.ts
index 490ed0e441a..47063287d28 100644
--- a/ionic/components/checkbox/checkbox.ts
+++ b/ionic/components/checkbox/checkbox.ts
@@ -70,6 +70,7 @@ const CHECKBOX_VALUE_ACCESSOR = new Provider(
})
export class Checkbox {
private _checked: boolean = false;
+ private _init: boolean;
private _disabled: boolean = false;
private _labelId: string;
private _fn: Function;
@@ -127,7 +128,9 @@ export class Checkbox {
private _setChecked(isChecked: boolean) {
if (isChecked !== this._checked) {
this._checked = isChecked;
- this.change.emit(this);
+ if (this._init) {
+ this.change.emit(this);
+ }
this._item && this._item.setCssClass('item-checkbox-checked', isChecked);
}
}
@@ -185,6 +188,13 @@ export class Checkbox {
*/
onTouched() {}
+ /**
+ * @private
+ */
+ ngAfterContentInit() {
+ this._init = true;
+ }
+
/**
* @private
*/
diff --git a/ionic/components/toggle/test/basic/index.ts b/ionic/components/toggle/test/basic/index.ts
index 55e03d46727..0591d7a36df 100644
--- a/ionic/components/toggle/test/basic/index.ts
+++ b/ionic/components/toggle/test/basic/index.ts
@@ -42,6 +42,14 @@ class E2EApp {
this.grapeDisabled = !this.grapeDisabled;
}
+ appleChange(ev) {
+ console.log('appleChange', ev);
+ }
+
+ bananaChange(ev) {
+ console.log('bananaChange', ev);
+ }
+
kiwiChange(ev) {
console.log('kiwiChange', ev);
this.kiwiValue = ev.checked;
diff --git a/ionic/components/toggle/test/basic/main.html b/ionic/components/toggle/test/basic/main.html
index d3906ae5b87..0cb8d0d4665 100644
--- a/ionic/components/toggle/test/basic/main.html
+++ b/ionic/components/toggle/test/basic/main.html
@@ -19,12 +19,12 @@
Apple, ngControl
-
+
Banana, ngControl
-
+
diff --git a/ionic/components/toggle/toggle.ts b/ionic/components/toggle/toggle.ts
index d0cf5715347..6247f3012cf 100644
--- a/ionic/components/toggle/toggle.ts
+++ b/ionic/components/toggle/toggle.ts
@@ -80,6 +80,7 @@ const TOGGLE_VALUE_ACCESSOR = new Provider(
})
export class Toggle implements ControlValueAccessor {
private _checked: boolean = false;
+ private _init: boolean;
private _disabled: boolean = false;
private _labelId: string;
private _activated: boolean = false;
@@ -191,9 +192,12 @@ export class Toggle implements ControlValueAccessor {
* @private
*/
private _setChecked(isChecked: boolean) {
+ console.debug('_setChecked')
if (isChecked !== this._checked) {
this._checked = isChecked;
- this.change.emit(this);
+ if (this._init) {
+ this.change.emit(this);
+ }
this._item && this._item.setCssClass('item-toggle-checked', isChecked);
}
}
@@ -248,6 +252,13 @@ export class Toggle implements ControlValueAccessor {
*/
onTouched() {}
+ /**
+ * @private
+ */
+ ngAfterContentInit() {
+ this._init = true;
+ }
+
/**
* @private
*/