How to change attribute value on event ionic



I am working on drag drop application in ionic. I am using jQuery UI for drag and drop events.

 <li on-hold="longPressed($event )" on-double-tap="onDoubleTap(item)" data-zone="z1" data-id="{{}}" class="listitem" ng-click="z1ElementClicked(item)" ng-repeat="item in handle.z1level" jqyoui-droppable="{onDrop : 'onDropp(event , ui)'  }" data-drop="true" class="btn btn-primary" data-drag="false" data-jqyoui-options="{helper: 'clone', revert: 'invalid', appendTo: 'body'}"  jqyoui-draggable="{onDrag : 'onDragg(event)' , animate:true}" ><a>{{}}</a></li>

This is my element i am dragging what i want is when user long press on screen i want data-drag=“false” change to data-drag=“true”

   $scope.longPressed = function(event){

   $("drag" , "true");

I am using this code to change the attributes and its working fine but problem is my element is not dragging even after i have changed the attributes is there any way of reloading dom after changing element attribute.?


use the enable/disable methods


Hello @bengtler

Thanks For the reply

 $scope.longPressed = function(event) {
 $( "enable" );


This is what is just try to do can you give me small example how can i use disable function initiallly my data-drag attribute is false. on long press i $( “enable” );
inserted this but its not working



Ok i just tried $( “enable” );

but i have to click again to drag what i want is when use long hold on li element i want to make it draggable same time and on release disable it.


@bengtler actually its reinitializing draggable again is it possible to just reload when i am changing li element attribute? i am using angular-dragdrop directive for this.



i think i used it once… long time ago to enable it on the fly

But i do not understand you: "its reinitializing draggable again"
Does it automatically gets reinitialized or what?