I’m working on a custom dialog like
smoke.js, …etc. and i was wondering what is the best practice do something like this.
Currently it works like this…
- When app starts, I create an initializer called alert, which is an
- To create a dialog, I would call
confirmfunction is called it would update
messageattribute, and setup interval function of 250ms, so it would poll
- When message gets updated,
x-alertcomponent would show dialog. On confirmation or cancel, it would set shared property
confirmfunction will return a promise. Promise is resolve or rejected based on answer (true => resolve, false => reject), and it would clear interval if answer was found. Other than that, interval will keep checking.
Is there a simpler approach or a way around using
setInterval for checking for answer?
I’ve created a gist for the alert service that gets injected in Route, Controller, Component scope.