我在angularjs很新,我遇到了麻烦,
我有这样的HTML:
<section class="content" ng-app="offer">
<div ng-controller="OfferController">
...
<input name="Attachment" type="file" class="file_up" onchange="angular.element(this).scope().change(this)" ng-model="Attachment" />
<span>{{Attachment}}</span> //i can't get it
...
</div>
</section>
Run Code Online (Sandbox Code Playgroud)
和脚本:
var myApp = angular.module('offer', []);
myApp.controller('OfferController', ['$scope', function ($scope) {
$scope.change = function (element) {
if (element.files.length > 0) {
$scope.Attachment = element.files[0].name;
}
else {
$scope.Attachment = "";
}
console.log($scope.Attachment); // I can get changed value in console
}
}]);
Run Code Online (Sandbox Code Playgroud)
图片:

我可以在控制台中获得更改的值但是当输入的值更改时我无法进入html端.非常感谢您提前寻求帮助.