I have a textarea
attached to a $scope
variable called newNoteText
. The html is:
<textarea spellcheck="true"
ng-model="newNoteText"></textarea>
There's also a button that saves the typed note.
<button type="button" class="btn btn-default"
ng-click="btnPost_clicked(newNoteText)">Post
</button>
Here's the controller function btnPost_clicked
:
$scope.btnPost_clicked = function(newNoteText) {
$scope.addNote(newNoteText);
$scope.newNoteText = '';
}
I confirmed via console.log that $scope.newNoteText is being reset to an empty string. But the textarea still holds the old text.