Skip to content

Instantly share code, notes, and snippets.

<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>
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'
// 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" : {
// ...
}
}
yo angularfire:route Host
yo angularfire:service Host
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
<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>
bower install --save underscore
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',
mkdir kahootClone
cd kahootCLone
yo angularfire:app kahootClone
@rotemtam
rotemtam / shareOnWhatsApp.js
Created February 28, 2015 17:45
Whatsapp link creation
var shareOnWhatsApp = function(msg) {
window.location.href = 'whatsapp://send?text=' + encodeURIComponent(msg);
}