我有这个奇怪的问题。当我在控制器中清除模型时,绑定到具有ng-model的模型的输入字段在提交表单时不会清除。
控制器
angular.module('starter.controllers', [])
.controller('DashCtrl', ["$scope", function($scope) {
$scope.clearInput = function() {
console.log("I get there...");
//Here's the issue!!! It's not working as expected!
$scope.message = "";
};
}]);
模板
<ion-view title="Dashboard">
<ion-content class="padding">
<form name="myform" ng-submit="clearInput()">
<label class="item item-input">
<input type="text" ng-model="message"/>
</label>
<button type="submit" class="button button-positive" >
button-positive
</button>
</form>
</ion-content>
</ion-view>
我得到控制台输出“我到达那里”,因此该功能被激活。我在这里缺少什么?