Something strange is happening. Whenever I try to clear the model in the controller, the input field that is bound to the model using ng-model does not get cleared when the form is submitted.
Controller
angular.module('starter.controllers', [])
.controller('DashCtrl', ["$scope", function($scope) {
$scope.clearInput = function() {
console.log("I get there...");
//This is where the problem lies! It's not clearing as expected!
$scope.message = "";
};
}]);
Template
<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" >
Submit
</button>
</form>
</ion-content>
</ion-view>
The console shows "I get there" so the function is being triggered. What am I missing here?