-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
63 lines (54 loc) · 1.64 KB
/
index.html
File metadata and controls
63 lines (54 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html>
<head>
<title>Tic Tac Toe</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>
<script src="gameScript.js"></script>
</head>
<body ng-app="myApp">
<h2 style="text-align: center;">Tic Tac Toe</h2>
<div ng-view></div>
<script>
var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
$routeProvider
.when("/",{
templateUrl : "register.htm",
controller : "regCtrl"
})
.when("/gameConsole", {
templateUrl : "gameConsole.htm",
controller : "gameContol"
});
});
app.controller("regCtrl", function ($scope, $location){
$scope.reg = function(){
if ($scope.namePlayer1 == undefined || $scope.namePlayer2 == undefined){
$scope.errormsg = "Please enter the name."
return;
}else{
localStorage.setItem("p1", $scope.namePlayer1)
localStorage.setItem("p2", $scope.namePlayer2)
$location.path("gameConsole")
}
}
});
app.controller("gameContol", function ($scope, $location) {
$scope.namePlayer1 = localStorage.getItem("p1");
$scope.namePlayer2 = localStorage.getItem("p2");
$scope._exit = function(){
reset();
XScore = 0
OScore = 0
localStorage.setItem("p1", null)
localStorage.setItem("p2", null)
$location.path("/")
}
});
</script>
</body>
</html>