diff --git a/src/components/alert/alert-component.ts b/src/components/alert/alert-component.ts
index d0ba6927a43..3a83fb9141c 100644
--- a/src/components/alert/alert-component.ts
+++ b/src/components/alert/alert-component.ts
@@ -145,7 +145,8 @@ export class AlertCmp {
label: input.label,
checked: !!input.checked,
disabled: !!input.disabled,
- id: 'alert-input-' + this.id + '-' + index
+ id: 'alert-input-' + this.id + '-' + index,
+ handler: isPresent(input.handler) ? input.handler : null,
};
});
@@ -237,12 +238,20 @@ export class AlertCmp {
input.checked = (checkedInput === input);
});
this.activeId = checkedInput.id;
+
+ if (checkedInput.handler) {
+ checkedInput.handler(checkedInput);
+ }
}
}
cbClick(checkedInput: any) {
if (this.enabled) {
checkedInput.checked = !checkedInput.checked;
+
+ if (checkedInput.handler) {
+ checkedInput.handler(checkedInput);
+ }
}
}
diff --git a/src/components/select/select.ts b/src/components/select/select.ts
index e06c67a4c39..9b0587076d2 100644
--- a/src/components/select/select.ts
+++ b/src/components/select/select.ts
@@ -296,6 +296,7 @@ export class Select extends Ion implements AfterContentInit, ControlValueAccesso
handler: () => {
this.onChange(input.value);
this.ionChange.emit(input.value);
+ input.ionSelect.emit(input.value);
}
};
}));
@@ -319,7 +320,14 @@ export class Select extends Ion implements AfterContentInit, ControlValueAccesso
label: input.text,
value: input.value,
checked: input.selected,
- disabled: input.disabled
+ disabled: input.disabled,
+ handler: (selectedOption: any) => {
+ // Only emit the select event if it is being checked
+ // For multi selects this won't emit when unchecking
+ if (selectedOption.checked) {
+ input.ionSelect.emit(input.value);
+ }
+ }
};
});
diff --git a/src/components/select/test/multiple-value/app-module.ts b/src/components/select/test/multiple-value/app-module.ts
index be4ce4cac3f..7490379e4ac 100644
--- a/src/components/select/test/multiple-value/app-module.ts
+++ b/src/components/select/test/multiple-value/app-module.ts
@@ -41,6 +41,10 @@ export class E2EPage {
console.log('onSubmit', data);
}
+ toppingsSelect(selectedValue: any) {
+ console.log('Selected', selectedValue);
+ }
+
}
diff --git a/src/components/select/test/multiple-value/main.html b/src/components/select/test/multiple-value/main.html
index 7466f1585d3..d68b7cbf1b7 100644
--- a/src/components/select/test/multiple-value/main.html
+++ b/src/components/select/test/multiple-value/main.html
@@ -19,7 +19,7 @@
Mushrooms
Onions
Pepperoni
- Pineapple
+ Pineapple
Sausage
Spinach
diff --git a/src/components/select/test/single-value/app-module.ts b/src/components/select/test/single-value/app-module.ts
index b5ca7888660..6acd44d8a2e 100644
--- a/src/components/select/test/single-value/app-module.ts
+++ b/src/components/select/test/single-value/app-module.ts
@@ -67,8 +67,12 @@ export class E2EPage {
console.log('Gaming Select, Change value:', selectedValue);
}
- stpSelect() {
- console.log('STP selected');
+ musicSelect(selectedValue: any) {
+ console.log('Music selected', selectedValue);
+ }
+
+ notificationSelect(selectedValue: any) {
+ console.log('Notification select', selectedValue);
}
statusChange(ev: string) {
diff --git a/src/components/select/test/single-value/main.html b/src/components/select/test/single-value/main.html
index 0d43bbfa3ae..54ff20ddfce 100644
--- a/src/components/select/test/single-value/main.html
+++ b/src/components/select/test/single-value/main.html
@@ -48,7 +48,7 @@
Enable
Mute
Mute for a week
- Mute for a year
+ Mute for a year
@@ -61,7 +61,7 @@
Pearl Jam
Smashing Pumpkins
Soundgarden
- Stone Temple Pilots
+ Stone Temple Pilots