Now in my controller I don't ...">

How to catch ngchange event in input file

I have a file input

<input type="file" ng-change="action()">

Now in my controller I don't want to do selectors and stuff. so i just

$scope.action = () -> 
  ...

      

However, I want certain behavior in such a way that as long as the user selects the file $ scope.action is called, instead of onchange is there an onselect event in angular?

+3


source to share


1 answer


Use thisss



<input ng-model="photo"
       onchange="angular.element(this).scope().file_changed(this)"
       type="file" accept="image/*" />


$scope.file_changed = function(element, $scope) {

     $scope.$apply(function(scope) {

     });
});

      

+8


source







All Articles