This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="row" ng-if="game.data.state == 'waitingForPlayers'"> | |
| <div class="jumbotron"> | |
| <h1>Join our game!</h1> | |
| <h2>Go to http://someaddress.com on your smartphone</h2> | |
| <h2>Our PIN code is {{game.$id}}</h2> | |
| <p><button class="btn btn-success" ng-click="startGame()">Let's begin!</button></p> | |
| </div> | |
| <div class="col-md-12"> | |
| <div class="well"> | |
| <h3>Who's here:</h3> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('kahootCloneApp') | |
| .controller('HostCtrl', function ($scope, Host, $routeParams,fbutil) { | |
| Host.init($routeParams.PIN) | |
| .then(function() { | |
| Host.syncObject.$bindTo($scope, 'game'); | |
| }); | |
| $scope.startGame = function() { | |
| $scope.game.data.state = 'preQuestion' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // we store data about games as nodes of the /games node | |
| { | |
| "games" : { | |
| "123456" : { // Game identifiers will be 6 digit PIN codes | |
| // Gamestate, key-value pairs | |
| }, | |
| "234567" : { | |
| // ... | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| yo angularfire:route Host | |
| yo angularfire:service Host |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('kahootCloneApp') | |
| .controller('MainCtrl', function ($scope, $location, _, fbutil) { | |
| $scope.newGame = function() { | |
| $scope.creatingGame = true; | |
| // Generate random 6 digit pincode for the game | |
| var PIN = _.random(100000,999999), | |
| // Connect to Firebase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="jumbotron"> | |
| <h1>Let's play trivia.</h1> | |
| <p class="lead"> | |
| In real time! | |
| </p> | |
| <p><a ng-if="!creatingGame" class="btn btn-lg btn-success" ng-click="newGame()">Start new Game</a></p> | |
| <p><a ng-if="creatingGame" ng-disabled="true" class="btn btn-lg btn-success" ng-click="newGame()">Creating game..</a></p> | |
| <p><a class="btn btn-lg btn-success" ng-href="#/player">Join Existing Game</a></p> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bower install --save underscore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var underscore = angular.module('underscore', []); | |
| underscore.factory('_', ['$window', function($window) { | |
| return $window._; // assumes underscore has already been loaded on the page | |
| }]); | |
| angular.module('kahootCloneApp', [ | |
| 'ngAnimate', | |
| 'ngCookies', | |
| 'ngResource', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir kahootClone | |
| cd kahootCLone | |
| yo angularfire:app kahootClone |