This is an example of my HTML code:
<input type="text" name="message" ng-model="senderMessage">
<button type="submit" ng-click="sendSenderMessage(1,5,senderMessage)">
Click Me
</button>
Here is my JavaScript controller function:
$scope.sendSenderMessage = function (bsid, srid, message) {
$scope.senderMessage = message;
$http.post(url + 'c_chat/sendSenderMessageJson', {
bsid: bsid,
srid: srid,
message: $scope.senderMessage
})
.success(function (data) {
console.log(data);
$scope.chatForm();
$scope.startChat(srid);
});
}
Additional function in the code:
$scope.chatForm = function () {
$scope.senderMessage = "";
}
One issue I am facing is that I cannot reset $scope.senderMessage to blank.