Skip to content

Instantly share code, notes, and snippets.

@Sailias
Last active December 15, 2015 07:28
Show Gist options
  • Save Sailias/5223177 to your computer and use it in GitHub Desktop.
Save Sailias/5223177 to your computer and use it in GitHub Desktop.
<div ng-controller='ChatCtrl'>
<div id='messages' ng-repeat="chat_message in chat_messages">
{{chat_message.text}}
</div>
</div>
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
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