Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods in $callbacks to support promises? #507

Closed
ktulufrozen opened this issue Jul 9, 2015 · 6 comments
Closed

Methods in $callbacks to support promises? #507

ktulufrozen opened this issue Jul 9, 2015 · 6 comments
Assignees

Comments

@ktulufrozen
Copy link

I have the following scenario:

  • the user drags a node to a new location
  • before drop she is asked for a confirmation whether she is sure she wants to make the change
  • if yes, then make the change
  • if no, cancel the whole drag and drop

The way I implemented the confirmation is by using a modal which returns the answer in a promise. I trigger the modal in the "beforeDrop" method, but since it does not support promises, I can not cancel the event if the user chooses "No". As a workaround I have to manually put the node back where it was in this case.

It would be nice if all methods would support promises so that async operations can be done in the $callbacks methods.

Is this possible or in plan to do?

@didando8a
Copy link

I am having exactly the same problem since I am trying to use modals rather than confirm.

Thanks

@kmsheng
Copy link

kmsheng commented Aug 8, 2015

+1 for this feature, promise is needed here

@bronielsen
Copy link

Hi both. I had the same problem and found a solution that works. Unfortunately it involved changing the code. The change still works with the current version.

I have decided anyway, that I need to try to get it into the main branch code anyway, so I will make a branch and implement it soon.
See #262

@bronielsen
Copy link

I made two branches to implement it. Take a look and comment.

master...bronielsen:bronielsen-patch-confirmationDialog

and

master...bronielsen:bronielsen-patch-confirmationDialog-1

@StefanCodes
Copy link
Contributor

I decided to go for it and implement this using $q (Angular's promise service) as the original request stated. See PR #589

I don't think this will break anything or any existing code, but I've only tested it with my own app and with the demo pages, and only on a desktop web browser. Feedback would be appreciated.

Voles pushed a commit that referenced this issue Dec 20, 2015
@jacobscarter
Copy link
Contributor

Closing this issue due to inactivity. See #815 for more information.
Please create a new issue is this still occurs with the current version of the component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants