After selecting a file, I attempted to change the scope value to the file path.
This is an html file
<input type="file" name="file" onchange="angular.element(this).scope().showFilePath(this)">
<div>{{filename}}</div>
In the controller
angular.module('app')
.controller('UploadFile', function($scope){
$scope.filename = 'please upload a file'
$scope.showFilePath = function(file){
console.log(file.value)
$scope.filename = file.value
console.log($scope.filename)
}
})
When console.log($scope.filename)
displays "C:\fakepath\1m.jpg" but on the webpage it still shows "please upload a file".
Any suggestions on how to solve this issue?
Appreciate any help!