我是棱角分明的新人.每当在此字段上发生"更改"时,我都会尝试从HTML"文件"字段中读取上传的文件路径.如果我使用'onChange'它可以工作,但是当我使用'ng-change'的角度方式时,它不起作用.
<script>
var DemoModule = angular.module("Demo",[]);
DemoModule .controller("form-cntlr",function($scope){
$scope.selectFile = function()
{
$("#file").click();
}
$scope.fileNameChaged = function()
{
alert("select file");
}
});
</script>
<div ng-controller="form-cntlr">
<form>
<button ng-click="selectFile()">Upload Your File</button>
<input type="file" style="display:none"
id="file" name='file' ng-Change="fileNameChaged()"/>
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
fileNameChaged()永远不会调用.Firebug也没有显示任何错误.
angularjs ×1