You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
425 B

'use strict';
angular.module('myApp.chat', [
'btford.socket-io', 'ngRoute'
])
.controller('ChatCtrl', function ($scope, socket) {
$scope.msgs=[];
socket.on('newmsg', function (data) {
console.log(data);
$scope.msgs.push(data.text);
});
$scope.msg={
text: ""
};
$scope.send = function(){
console.log("emitting");
socket.emit("msg", $scope.msg, function(data){
});
};
});