Created
September 20, 2016 00:10
-
-
Save sax1johno/379a4b705f2049ab47e0f881cec8f6d8 to your computer and use it in GitHub Desktop.
Baseball Example created by sax1johno - https://repl.it/DdNO/3
This file contains 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
Empty file |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>repl.it</title> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains 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("MyApp", ["AtBat"]) | |
.controller("MyAppController", function($scope, AtBatState, GameState) { | |
$scope.balls = AtBatState.ball; | |
}); | |
angular.module("AtBat", []) | |
.directive("atBat", function() { | |
return { | |
controller: function(AtBatState, GameState) { | |
}, | |
template: "<div id='linefromfirsttosecond' ng-show='AtBatState.base >= 1'></div>", | |
link: function(scope, element, attributes) { | |
// This is where you draw stuff. | |
$(element).addChild(); | |
scope.AtBatState = AtBatState; | |
} | |
}; | |
}) | |
.factory("AtBatService", function(AtBatState, GameState) { | |
return { | |
single: function() { | |
AtBatState.Ball = 0; | |
AtBatState.Strike = 0; | |
} | |
} | |
}) | |
.value("AtBatState", { | |
"Base": 0, | |
"Ball": 0, | |
"Out": 0 | |
}).value("GameState", { | |
"Home": { | |
}, | |
"Away": { | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment