Yassine Yassine - 8 months ago 47
AngularJS Question

ng-model doesn't work when dragging and dropping an element

ng-model doesn't work when I drag and copy an input box, here is my code :

<input type="text" ng-model="test" draggable item="items" id="1">

<!--destination -->
<md-content class="bin" drop="handleDrop" droppable >

If I use the input box in the source item, the ng-model works, but when I bring it to the destination it doesn't work.Here is an example

thank you for help


I figure out that when I drag&drop the input the I can get the value of
in the source, and not in the destination (but it's ok for me )
here is an example

Answer Source

After some investigation and based on that response I find a solution.
the problem was that the cloned code doesn't compile,so angular doesn't know that the ng-model(for example) existe, but after compiling the code using $compile, it works