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

7 years ago
  1. 'use strict';
  2. angular.module('myApp.chat', [
  3. 'btford.socket-io', 'ngRoute'
  4. ])
  5. .controller('ChatCtrl', function ($scope, socket) {
  6. $scope.msgs=[];
  7. socket.on('newmsg', function (data) {
  8. console.log(data);
  9. $scope.msgs.push(data.text);
  10. });
  11. $scope.msg={
  12. text: ""
  13. };
  14. $scope.send = function(){
  15. console.log("emitting");
  16. socket.emit("msg", $scope.msg, function(data){
  17. });
  18. };
  19. });