Skip to content

Instantly share code, notes, and snippets.

@rotemtam
Last active August 29, 2015 14:28
Show Gist options
  • Select an option

  • Save rotemtam/951db1d184ccc41f2afb to your computer and use it in GitHub Desktop.

Select an option

Save rotemtam/951db1d184ccc41f2afb to your computer and use it in GitHub Desktop.
angular.module('kahootCloneApp')
.controller('PlayerCtrl', function ($scope, Player, $location,$routeParams) {
if(! $routeParams.hasOwnProperty('PIN')) {
$scope.game = {
data : {
state: 'joinGame'
}
}
} else {
Player.init($routeParams.PIN)
.then(function() {
Player.syncObject.$bindTo($scope,'game');
});
}
$scope.join = function() {
$scope.joining = true;
Player.join($scope.PIN, $scope.screenName)
.then(function() {
$location.path('/player/' + $scope.PIN)
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment