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

18
www/views/chat/chat.html Normal file
View File

@@ -0,0 +1,18 @@
<md-content class="md-padding">
<md-toolbar layout="row" class="o_purple300">
<div class="md-toolbar-tools">
<span>chat</span>
</div>
</md-toolbar>
<form>
<input id="m" ng-model="msg.text" /><button ng-click="send()">Send</button>
</form>
<md-list flex>
<md-subheader class="md-no-sticky">3 line item (with hover)</md-subheader>
<md-list-item ng-repeat="msg in msgs" ng-click="null">
<p>{{msg.text}}</p>
</md-list-item>
</md-list>
</md-content>

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

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