I might be wrong, but I think one way would be to pass a callback into returnCollectionsId and then call that callback from inside returnCollectionsId from the click event handler you set up. Then anytime element1 is clicked, your callback will be called, instead of just the first time.
If you wanted to use Observables I think you could use Rx.js without angular. Instead of returning a promise that sets up an on click handler and resolves when the onClick is called for the first time, you can return an Observable and subscribe to it in whatever code calls returnCollectionsId.
Thank you, I've tried both. The way I made everything, it doesn't want to wait for anything else but a Promise, unfortunately. Still launches immediately. Or I need a couple more days for the new information to sink in, and then I'll figure out how to get it to work. Will see, thank you again!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I might be wrong, but I think one way would be to pass a callback into
returnCollectionsId
and then call that callback from insidereturnCollectionsId
from the click event handler you set up. Then anytime element1 is clicked, your callback will be called, instead of just the first time.If you wanted to use Observables I think you could use Rx.js without angular. Instead of returning a promise that sets up an on click handler and resolves when the onClick is called for the first time, you can return an Observable and subscribe to it in whatever code calls
returnCollectionsId
.Here's a blog post about setting up Rx.js with click events from a few years ago codyburleson.com/respond-to-button...
Thank you, I've tried both. The way I made everything, it doesn't want to wait for anything else but a Promise, unfortunately. Still launches immediately. Or I need a couple more days for the new information to sink in, and then I'll figure out how to get it to work. Will see, thank you again!