Last active
December 15, 2015 07:28
-
-
Save Sailias/5223177 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-controller='ChatCtrl'> | |
<div id='messages' ng-repeat="chat_message in chat_messages"> | |
{{chat_message.text}} | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ChatCtrl = ($scope) -> | |
$scope.chat_messages = [] | |
# Subscribe to the chat client | |
SubscribeToChat.new( | |
{# Chat settings}, | |
(m) -> | |
# Callback when new chat is received | |
$scope.chat_messages.unshift(m) | |
) | |
$publish() -> | |
# Send chat message to the chat server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ChatCtrl.prototype.remove = ($scope) -> | |
# Logic to remove chat messages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment