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.

25 lines
505 B

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