I have a file dropzone to get data content of a file.
If I set the $scope.importData to null, it is not possible to assign data inside the drop handler anymore.
$scope.handleDrop = function(evt) {
if (window.File && window.FileReader && window.FileList && window.Blob) {
var files = evt.dataTransfer ? evt.dataTransfer.files : evt.target.files,
file = files[0],
reader = new FileReader();
reader.onloadend = function(evt) {
var content = evt.target.result;
if('' !== content) {
$scope.importData = content; //will work as long you do not set $scope.importData to null
$scope.$apply();
}
};
reader.readAsText(file);
}
};
I figured out the problem might be the ng-include. If I do it without the include, it will work.
Please try the Plunker...