Ons Notification - hide
-
Dear,
I am using:
https://onsen.io/reference/ons.notification.htmlWhat is the best way to hide it without user interaction? (timer/timeout)
The only ideas I can come up with are kinda hackish
Regards,
Maximvdw
-
@Maxim-Van-de-Wynckel Hi! The easiest way is probably to use
setTimeout
to destroy the alert.function showAlert() { ons.notification.alert('Hi there'); setTimeout(function() { var alert = document.querySelector('ons-alert-dialog'); if (alert) { alert.destroy(); } }, 800); }
-
@Fran-Diox said:
e easiest way is probably to use se
Thanks! , that was what I was looking for.
Tried the same thing, but my querySelector was a bit too overengineerdRegards,
Maxim
-
Is there a clean angularjs way to do this?
-
@Carson-H The notification object doesn’t create any scope for these simple alerts so currently the only way to do this is to grab the DOM element. There’s a
option.id
which you can use to set the alert element ID. I’m thinking about adding aoptions.timeout
for this purpose…