2014-07-02 10:56:09 -04:00
|
|
|
define [
|
|
|
|
"base"
|
2014-07-15 13:25:12 -04:00
|
|
|
"ide/chat/services/chatMessages"
|
2014-07-02 10:56:09 -04:00
|
|
|
], (App) ->
|
2014-07-15 13:25:12 -04:00
|
|
|
App.controller "ChatController", ($scope, chatMessages, @ide, $location) ->
|
|
|
|
$scope.chat = chatMessages.state
|
|
|
|
|
2014-07-08 05:08:38 -04:00
|
|
|
$scope.$watchCollection "chat.messages", (messages) ->
|
2014-07-04 10:46:21 -04:00
|
|
|
if messages?
|
2014-07-15 13:25:12 -04:00
|
|
|
$scope.$emit "messages:updated"
|
|
|
|
|
2014-07-08 05:08:38 -04:00
|
|
|
$scope.sendMessage = ->
|
2014-07-15 13:25:12 -04:00
|
|
|
chatMessages
|
|
|
|
.sendMessage $scope.newMessageContent
|
|
|
|
.then () ->
|
|
|
|
$scope.newMessageContent = ""
|
|
|
|
|
|
|
|
$scope.loadMoreMessages = ->
|
|
|
|
chatMessages.loadMoreMessages()
|
|
|
|
|
|
|
|
|