当我从普通JavaScript更改输入元素的值时,角度模型不会更新.是否有任何方法通过在更改后手动触发某些事件来以某种方式触发此更新?
<body ng-controller="MainCtrl">
<script>
function changeValue() {
var e = document.getElementById("field");
e.value = "updated value";
}
</script>
field: <input type="text" id="field" ng-model="field">{{field}}
<br>
<button onclick="changeValue()">Change the value</button>
</body>
Run Code Online (Sandbox Code Playgroud)
angularjs ×1