kendo-labs / angular-kendo

A project to create a robust set of Angular.js bindings for Kendo UI widgets
474 stars 209 forks source link

Error when "routing" away if object is destroyed before kendo gets to it #372

Open YonatanKra opened 10 years ago

YonatanKra commented 10 years ago

Here's a scenario that gives me an error: 1) I have a div that is a dropTarget. 2) When I "route" away from the view, the div is destroyed. 3) During the routing procedure, I get an error:

TypeError: cannot read property length of undefined
widget.extend.destroy at kendo.all.js 14036:22
angular-kendo.js 264:28

My angular-kendo was updated yesterday from the repository. Any idea why this happens?

mishoo commented 10 years ago

Please post some code that shows the error.

YonatanKra commented 10 years ago

Sorry. Here's my view simplified:

<div ng-repeat="item in items">
  <div  kendo-drop-target="dropTargets[$index].object" 
    k-options="dropTargets[$index].options">
  <!-- some draggable content comes here -->
  </div>
</div>

As for the model, options is set normally, except the "drop" function, which is quite complex:

drop: function(e){
 //this function replaces the content between a draggable item's source element and the drop target's content
replaceTargetWithSource(e);
}