damirarh / damirscorner-utterances

utteranc.es comments for https://damirscorner.com
0 stars 0 forks source link

blog/posts/20220211-CustomEventTypesInIonic #150

Open utterances-bot opened 8 months ago

utterances-bot commented 8 months ago

Custom event types in Ionic | Damir's Corner

https://www.damirscorner.com/blog/posts/20220211-CustomEventTypesInIonic.html

antiftw commented 8 months ago

Not sure if you read these comments since the post is a bit older, but your preferred solution sadly does not work (anymore).

The inputEvent.detail.value always returns on.

I've console.log(inputEvent.detail) and noticed there is a checked variable, but when trying to use this I get another error: "Property 'checked' does not exist on type 'InputChangeEventDetail'"

I did find another solution however,which I'll leave here for other who might encounter this post:

import { CheckboxChangeEventDetail } from '@ionic/angular';
onInputChange(inputEvent: CustomEvent<CheckboxChangeEventDetail>) {
  console.log(inputEvent.detail.value);
}
antiftw commented 8 months ago

Edit, it should be :

inputEvent.detail.checked;

instead of

inputEvent.detail.value;

to get the toggle value.