0

I have a fileload method the code works when I use it separately from my project, but once I integrate it with my angular 5 projects it doesn't work

Error:

enter image description here

Code:

MM.Backend.File.load = function() {
    var promise = new Promise();

    this.input.type = "file";

    this.input.onchange = function(e) {
        var file = e.target.files[0];
        if (!file) { return; }

        var reader = new FileReader();
        reader.onload = function() { promise.fulfill({data:reader.result, name:file.name}); }
        reader.onerror = function() { promise.reject(reader.error); }
        reader.readAsText(file);
    }.bind(this);

    this.input.click();
    return promise;
}
Nazim Kerimbekov
  • 4,712
  • 8
  • 34
  • 58
TraiOmar
  • 3
  • 2

0 Answers0