This is a migrated thread and some comments may be shown as answers.

AngularJS - manually calling $scope.$apply

5 Answers 171 Views
Drag and Drop
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 21 Aug 2014, 05:16 PM
If I modify the scope from a callback (data-k-dragend="onDragEnd") then it seems I have to manually call $scope.$apply.  I had assumed that KendoUI with the AngularJS integration would automatically wrap this for me.  Can you confirm if I'm doing something wrong or if this is planned to be fixed in a future release?

Thanks!

  Nick

5 Answers, 1 is accepted

Sort by
0
Mihai
Telerik team
answered on 22 Aug 2014, 08:15 AM
Hi Nick,

You can prefix event handlers with "k-on-", i.e. for your case that would be: k-on-dragend="onDragEnd($kendoEvent)".  See documentation.

If you use the "k-on-" prefix, scope digesting will be handled for your automatically.  Note that you need to pass an expression, not a function reference -- it will only be evaluated when the event is triggered.

Regards,
Mihai
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Andrei
Top achievements
Rank 1
answered on 26 Aug 2014, 04:02 PM
I try to using k-on-dragend
<div kendo-tree-view="treeView"
                         k-data-source="treeMenu"
                         k-template="itemTemplateMenu"
                         k-drag-and-drop="true"
                         k-on-dragend="onDragEndEvent(kendoEvent)"
                         k-on-change="onTreeSelect(kendoEvent)"
                         k-drop="onTreeDrop"></div>

and get current error:

at Object.<anonymous> (http://localhost:6247/Scripts/kendo/2014.2.716/kendo.all.min.js:42:11940)
at n.(anonymous function) (http://localhost:6247/Scripts/kendo/2014.2.716/kendo.all.min.js:42:6882)
at Object.r.apply.next (http://localhost:6247/Scripts/kendo/2014.2.716/kendo.all.min.js:42:6921)
at Object.<anonymous> (http://localhost:6247/Scripts/kendo/2014.2.716/kendo.all.min.js:42:12174)
at n.(anonymous function) (http://localhost:6247/Scripts/kendo/2014.2.716/kendo.all.min.js:42:6882)
at Object.r.apply.next (http://localhost:6247/Scripts/kendo/2014.2.716/kendo.angular.min.js:9:1906)
at Object.<anonymous> (http://localhost:6247/Scripts/kendo/2014.2.716/kendo.angular.min.js:9:7159)
at n.(anonymous function) [as $angular_makeEventHandler] (http://localhost:6247/Scripts/kendo/2014.2.716/kendo.angular.min.js:9:1867)
at Object.<anonymous> (http://localhost:6247/Scripts/kendo/2014.2.716/kendo.angular.min.js:9:6822)
at n.(anonymous function) [as $angular_init] (http://localhost:6247/Scripts/kendo/2014.2.716/kendo.angular.min.js:9:1867)
0
Andrei
Top achievements
Rank 1
answered on 27 Aug 2014, 06:22 AM
this error:  TypeError: undefined is not a function
0
Mihai
Telerik team
answered on 27 Aug 2014, 07:57 AM
Hi,

It works for me, here's a sample: http://dojo.telerik.com/OweG -- it dumps the kendoEvent with console.log on "dragend".

The error message you pasted doesn't help to identify the problem.  If you can still encounter the issue please provide a simple test case at http://dojo.telerik.com/

Regards,
Mihai
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Andrei
Top achievements
Rank 1
answered on 27 Aug 2014, 10:18 AM
thank you  for example. I found problem.  I added script kendo.angular.min.js with kendo.all.min.js
Tags
Drag and Drop
Asked by
Jeff
Top achievements
Rank 1
Answers by
Mihai
Telerik team
Andrei
Top achievements
Rank 1
Share this question
or