i have this controller:
function controller(chatService,userService) {
const vm = this;
vm.postPhoto = postPhoto;
function postPhoto(files) {
console.log(files);
}
}
this is where i want to acess the function postPhoto to get the files and post to the server:
<input type="file" id="image_uploads"
onchange="angular.element(this).scope().postPhoto(this.files)"
style="display:none;" accept=".jpg, .jpeg, .png">
and i got this error:
Uncaught TypeError: Cannot read property 'postPhoto' of undefined
everything works when i use "$scope" instead of "this" but i am asking how or if i can do that without changing the way i do scope..besides ng-change doesnt work on upload files