I am using angularjs/javascript code for image Uploading but i got stuck in variable binding , can anyone help me out, here is my code.
var image_source;
$scope.uploadedFile = function(element) {
reader.onload = function(event) {
image_source = event.target.result;
$scope.$apply(function($scope) {
$scope.files = element.files;
});
}
console.log(image_source,event.target.result, element.files[0], "***not working here***");
I'm binding varibale named image_source
within function but when i access this outside the function it always return undefined why ?
PS:- i can get this in the typescript using phatarrow operator
but how to do in javascript i dont know