I am trying to upload an image and return its src
using FileReader
.
fileUpload(event) {
var fr = new FileReader();
fr.onload = function() {
getImgSrc(fr.result)
}
}
getImgSrc(src) {
console.log(src);
}
This returns Cannot find name 'getImgSrc'
However if I do this.getImgSrc(fr.result)
I receive error getImgSrc does not exist on type'MSBaseReader'
of course because the context of this
. How do I access the method getImgSrc
to return my async variable?