I got an
<input type="file" id="aircraftList" name="aircraftList" file-upload multiple/>
bound to a directive
angular.module("app.directives").directive('fileUpload', function () {
return {
scope: true,
link: function (scope, el, attrs) {
el.bind('change', function (event) {
scope.$emit("fileSelected", { files: event.target.files, field: event.target.name });
});
}
};
});
I catch this event in a controller:
$scope.$on("fileSelected", function (event, args) {
$scope.$apply(function () {
switch (args.field) {
case "aircraftList":
self.attachments.aircraftList = args.files;
break;
default:
break;
}
});
});
For some reason this works perfectly well in Chrome and Firefox, but fails in IE11 with the following error:
If I dont put the $apply, chrome is not updating the view, but IE is. If I put the $apply, Chrome works perfect and IE breaks.
Anyone knows what and why it goes wrong here?