简体   繁体   English

拖放元素时ng-model不起作用

[英]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 : 当我拖动并复制输入框时,ng-model不起作用,这是我的代码:

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

 <!--destination -->
 <md-content class="bin" drop="handleDrop" droppable  >
        </md-content>
{{test}}

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 如果我使用的输入框源项目时,NG-模型作品,但是当我把它带到目的地不work.Here是一个例子
thank you for help 谢谢你的帮助
Update 更新
I figure out that when I drag& drop the input the I can get the value of test in the source, and not in the destination (but it's ok for me ) here is an example 我弄清楚,当我拖放输入端的我能得到的值test源,而不是在目的地(但它的确定对我来说)下面是一个例子

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 问题是克隆的代码无法编译,因此angular不知道ng-model(例如)存在,但是在使用$ compile编译代码后,它可以工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM