#how to call Dialog::alert when click a button
1 messages · Page 1 of 1 (latest)
If you're using Livewire you can create a function in the Livewire class. If you're using Inertia and VueJS I've found I have to create a new endpoint for it. I've actually moved to LiveWire for all my NativePHP Mobile apps
thanks @light badge , but I want to use blade + vanilla js, how to call from js code ? do i need to make an ajax request and call Dialog from controller code ?
Yeah, you'd need to use ajax via JavaScript
nice, thanks for your help.
I really recommend LiveWire... it's easy to use... Check out the screencasts: https://livewire.laravel.com/screencast/getting_started/installation
ok, i will try it
@light badge I tried to listen the Dialog event in js with
@use(Native\Mobile\Events\Alert\ButtonPressed)
<script>
Native.on(@js(ButtonPressed::class), (index, label) => {
alert(You pressed button ${index}: ${label})
})
</script>
but there's no any alert after I press button on Dialog, and i debug in js code the typeof Native = undefined
I don't see any suggestion in nativephp document for this
can you help me see it please ? thanks
and I still got the event via a listener in php code