-
Notifications
You must be signed in to change notification settings - Fork 572
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
If I change data-drop value after the initialization the directive does not update its behavior. #283
Comments
+1 |
@mentalernie At least we know that it isn't something in our own code, because the demo here: http://codef0rmer.github.io/angular-dragdrop/#!/ctrl, doesn't work either. After you spell the correct character, the letters are supposed to not be draggable anymore. |
It would seem that the watcher for the data-drop and data-drag attributes is being killed prematurely. On lines 334 and 398 of the non-minified codebase is this:
This is killing the watcher right after the initialization. Commenting/removing those blocks of code cause everything to work properly. |
EDIT: The fix that I mentioned above, leads to some weird issues, where droppable areas are not accepting the draggables. I am still investigating. |
@bradrich The annotated code above is for static attributes only such as @mentalernie If you want the behavior to be dynamic, you've to use a model and then use it in the DOM. For example, |
@codef0rmer I'm sorry but I was talking on "data-drop" |
@codef0rmer @mentalernie is correct. The data-drop feature is not working with a dynamic {{...}} approach. Your demo that I pasted the link to above shows that. |
@bradrich @mentalernie How can I reproduce the issue with data-drop? |
+1 |
I am having this issue as well. |
Here is how I have been able to overcome the issue:
So far, I have had good luck with this implementation. Notes:
|
For me, nor the drag is reacting to changes in the data-drag attribute. I have something like that: $scope.textIsDraggable = function(index) {
return $scope.draggableText == index;
} and then <div class="card-text" ng-repeat="text in design.texts track by $index" ng-class="{'draggable': textIsDraggable($index)}" id="card-text-{{$index}}" data-drag="{{textIsDraggable($index)}}" data-index="{{$index}}" data-containment="offset" jqyoui-draggable="{ onStop: 'setDesignTextPosition' }"></div> Yet if I change |
No description provided.
The text was updated successfully, but these errors were encountered: