それはもっとjavascriptの問題です。ここで回答されたように、この回答。角度では、次のようになります。
<!doctype html>
<html lang="en">
<head >
<meta charset="UTF-8">
<title>Upload Image</title>
<script type="text/javascript" src="angular.min.js"></script>
<script type="text/javascript">
angular.module('myApp', []).
controller('UploadCtrl', ['$scope', function (scope) {
scope.image = "";
}]).
directive('myUpload', [function () {
return {
restrict: 'A',
link: function (scope, elem, attrs) {
var reader = new FileReader();
reader.onload = function (e) {
scope.image = e.target.result;
scope.$apply();
}
elem.on('change', function() {
reader.readAsDataURL(elem[0].files[0]);
});
}
};
}]);
</script>
</head>
<body ng-app="myApp">
<div ng-controller="UploadCtrl">
<img ng-if="image" src="{{image}}" alt="">
<form action="">
<input my-upload type="file" name="upload">
</form>
</div>
</body>
</html>