I've made a directive for file upload. When I'm trying to upload only the same file, the dialog which is after uploading doesn't show. I don't know how to figure it out to open next dialog every time.
export function fileReaderDirective() {
'ngInject';
let directive = {
restrict: 'A',
require: '?ngModel',
link: fileReaderLink
};
return directive;
}
function fileReaderLink(scope, element, attrs, ngModel){
if( attrs.type === 'file' && ngModel ) {
element.bind('change', function(event) {
scope.$apply(function() {
ngModel.$setViewValue(event.target.files);
});
});
}
}
<input name="file" id="image-upload" type="file" ng-model="file" filereader/>