Reputation: 58702
AngularJS 1.6.9
I have a simple file upload on JSFiddle, not sure why ngf-select event is not triggering while other things seems working, and no console errors.
https://jsfiddle.net/bheng/nbo3wkr7/
<div ng-app="ngApp" ng-controller="ngController">
<h1>
{{title}}
</h1>
<h3>
{{title2}}
</h3>
<h6>
{{title3}}
</h6>
<input class="pull-right" type="file" ngf-max-size="20MB" ngf-select="$scope.uploadFile($file, $invalidFiles)" ngf-pattern="'*zip*'" />
</div>
var ngApp = angular.module("ngApp", []);
ngApp.controller('ngController', ['$scope', function($scope) {
$scope.title = 'File Upload via AngularJS';
$scope.title2 = 'Accepted File Type : *zip* only';
$scope.title3 = 'Need to make a POST after';
$scope.uploadFile = function(file, invalidFiles) {
console.log(file.name, file.size, file.type);
};
}]);
$scope.uploadFile() never get to executed
Upvotes: 0
Views: 107
Reputation: 11975
It should be
ngf-select="uploadFile($file, $invalidFiles)"
instead of
ngf-select="$scope.uploadFile($file, $invalidFiles)"
Upvotes: 1