main.js 906 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. angular.module('taboo', ['chatServices', 'tabooServices'])
  2. function partial(template) {
  3. return jsRoutes.controllers.Assets.at('partials/'+template+'.html').url;
  4. }
  5. function ViewCtrl($scope, Connection) {
  6. $scope.service = Connection;
  7. $scope.partial = partial;
  8. $scope.view = 'about';
  9. $scope.nav = [
  10. {partial: 'about', name: 'About'},
  11. {partial: 'chatRoom', name: 'Chat'}
  12. ];
  13. $scope.setView = function(p) {
  14. $scope.view = p;
  15. }
  16. $scope.$on('ws:connected', function() {
  17. $scope.view = 'chatRoom';
  18. });
  19. }
  20. function LoginCtrl($scope, Connection) {
  21. $scope.service = Connection;
  22. }
  23. function ChatCtrl($scope, Chat) {
  24. $scope.service = Chat;
  25. $scope.onType = function(event) {
  26. if(event.keyCode == 13) {
  27. Chat.send($scope.text);
  28. $scope.text = '';
  29. event.originalEvent.preventDefault();
  30. }
  31. }
  32. }
  33. function GameCtrl($scope, Taboo) {
  34. $scope.game = Taboo;
  35. }