main.js 763 B

12345678910111213141516171819202122232425262728293031323334353637
  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.view = function(connected) {
  8. if(connected) {
  9. return partial("chatRoom");
  10. }
  11. else {
  12. return partial("about");
  13. }
  14. }
  15. }
  16. function LoginCtrl($scope, Connection) {
  17. $scope.service = Connection;
  18. }
  19. function ChatCtrl($scope, Chat) {
  20. $scope.service = Chat;
  21. $scope.onType = function(event) {
  22. if(event.keyCode == 13) {
  23. Chat.send($scope.text);
  24. $scope.text = '';
  25. event.originalEvent.preventDefault();
  26. }
  27. }
  28. }
  29. function GameCtrl($scope, Taboo) {
  30. $scope.game = Taboo;
  31. }