view raw
Mantvydas Ozerenskis Mantvydas Ozerenskis - 6 months ago 58
AngularJS Question

Kendo uploader with angular doesn't update scope

Why Kendo Uploader with angular doesn't apply changes in UI?

Let's say on select event (same on success):

$scope.onSelect = function(e) {
var message = $.map(e.files, function(file) { return; }).join(", ");
kendoConsole.log("event :: select (" + message + ")");
$scope.uiUpdate = "doesn't work";

Dojo eg.:

If I run scope apply function then it works, but I don't like this solution.


Unfortunately, you will have to use $scope.$apply because the event is triggered without Angular knowing about it. This Kendo Upload component seems to be a jQuery thing that was made somewhat compatible with Angular.

The best thing you can do is to create a function that you can use all around:

function kendoEvent($scope, eventHandler) {
    return $scope.$apply(eventHandler);

$scope.onSelect = kendoEvent($scope, function (event) {