Is there a way for me to display the image I choose in AngularJS, similar to uploading an image on StackOverflow where the selected picture appears before uploading?
I'm very new to this, so please be patient with me.
Controller
$scope.uploadFile = function(parameter){
console.log(parameter[0]);
$scope.profilePic = parameter[0];
};
HTML
<div class="row">
<div class="col-md-12">
<img src="{{profilePic}}" class="img-responsive img-thumbnail"/>
</div>
</div>
<div class="row">
<div class="col-md-12">
<input type="file" name="image_path" class="form-control" onchange="angular.element(this).scope().uploadFile(this.files)" />
</div>
</div>
I've been experiencing issues using ng-change
, as it gives me an "anonymous function error".