I want to upload a file to my server, but I want the trigger to be an image. I constructed an example to test the base functionality, but it isn't responding the way I was expecting. The window launches properly, but I will eventually want to fire the code in a function after the file has been selected, and I can't get the function in the controller to fire from ng-change.
HTML:
<div ng-controller="myCtrl">
<div class="choose_file">
<img src="http://upload.wikimedia.org/wikipedia/commons/a/ae/Landscape_in_the_Adirondacks_Frederic_Edwin_Church.jpg" style="height: 300px; width: 400px"></img>
<input ng-model="someRandomValue" type="file" ng-change="trigger()" />
</div>
</div>
Controller:
myApp.controller('myCtrl', function($scope) {
$scope.trigger = function() {
alert("Changed");
};
});
I don't see any issues in the logic, but the alert never pops up. See fiddle for full code.