angularjs input file onchange error in jhipster webapp [duplicate]

Home / Uncategorized / angularjs input file onchange error in jhipster webapp [duplicate]

Question:
This question already has an answer here:ng-model for 10 answers

AngularJS v1.5.8

$scope.uploadImage = function(){
alert("change");
}

error in console:

Uncaught TypeError: Cannot read property ‘uploadImage’ of undefined at HTMLInputElement.onchange


Answer:
I think you have setup angular wrong, it should work like this:-

var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {

$scope.uploadImage = function() {
alert("change");
}
});

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *