I can not find how to delete messages.
I thought re-assigning messages array, I could have solved but I couldn't.
I just write down code in my thought.
The question is how to refresh message like just opening chat room.
// in html
<div ng-controller="ChatRoomCtrl as AppView">
<simple-chat id="simple-chat"
messages="AppView.messages"
local-user="AppView.you"
send-function="AppView.sendMessage"
send-button-text="Send"
composer-placeholder-text="Write your message here"
show-user-avatar="true"
show-composer="true"
></simple-chat>
</div>
// in controller
app.cointroller('ChatRoomCtrl', ChatRoomCtrl);
function ChatRoomCtrl($scope) {
var vm = this;
vm.messages = [];
//after some messages send/receive,
// I wanna reduce message length;
function reduceMessages() {
var len = vm.messages.length;
vm.messages = vm.messages.splice(len - 100, len);
}
}
I can not find how to delete messages. I thought re-assigning messages array, I could have solved but I couldn't.
I just write down code in my thought. The question is how to refresh message like just opening chat room.