AngularJs $scope.$apply not working as expected -
i using controll: http://blueimp.github.io/jquery-file-upload/angularjs.html file uploading in angular, once file uploaded server return url , display client on success callback. plugin being used normal jquery file upload there angular directive wrapper provided i'm using.
here's how define callback:
$scope.options = { url: '/api/client/', type: 'put', done: function (event, data) { var scope = angular.element(this).scope(); scope.test = "doesn't work"; scope.$apply(function () { scope.test = "this doesn't work either"; }); } };
the file uploads fine, , done function called unable update view. tried changing scope, realised require $apply() function isn't working either.
i have tried
$scope.options = { url: '/api/client/', type: 'put', done: function (event, data) { $scope.test = "doesn't work"; $scope.$apply(function () { $scope.test = "this doesn't work either"; }); } };
and doesn't work. not sure why isn't updating view, , done call ajax success event don't see how specific plugin causing issues $scope.$apply. using angularjs 1.1.5, have tried 1.0.7 , getting same issue.
copied comment make clearer problem was:
i managed figure out problem. when using example had duplicate of ng-controller(their example nested within other controller) , though both using same controller seems update within nested controller scope. when removing duplicate ng-controller attribute works fine.
Comments
Post a Comment