This commit is contained in:
arnaucode
2017-02-03 08:56:51 +01:00
parent c4b7414770
commit 112745d6fa
1585 changed files with 450241 additions and 0 deletions

9
www/chat/chat.html Normal file
View File

@@ -0,0 +1,9 @@
a
<ul id="messages">
<li ng-repeat="msg in msgs track by $index">
{{msg}}
</li>
</ul>
<form>
<input id="m" ng-model="msg.text" /><button ng-click="send()">Send</button>
</form>

22
www/chat/chat.js Normal file
View File

@@ -0,0 +1,22 @@
'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){
});
};
});