Created
May 19, 2016 23:48
-
-
Save zekenie/69910d07899170e6d9f158ccd4166466 to your computer and use it in GitHub Desktop.
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"> | |
</head> | |
<body> | |
<div ng-app="CounterApp"> | |
<div ng-controller="CounterCtrl"> | |
<div ng-repeat="count in counts track by $index"> | |
<input ng-model="counts[$index]"> | |
<button ng-click="incScore($index)">Inc</button> | |
</div> | |
</div> | |
</div> | |
<script src="/angular/angular.js"></script> | |
<script src="/horizon/horizon.js"></script> | |
<script> | |
angular.module('CounterApp', []) | |
.controller('CounterCtrl', function($scope) { | |
$scope.counts = [0,0,0,0]; | |
$scope.incScore = function(athleteNum) { | |
$scope.counts[athleteNum]++; | |
} | |
}); | |
</script> | |
</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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<div ng-app="HelpApp"> | |
<div ng-controller="HelpCtrl"> | |
<form> | |
<input placeholder="name" ng-model="newHelpRequest.name"> | |
<input placeholder="problems" ng-model="newHelpRequest.message"> | |
<button ng-click="getHelp(newHelpRequest)">Help!</button> | |
</form> | |
<ul> | |
<li ng-repeat="helpRequest in helpQueue"> | |
{{helpRequest.name}} : {{helpRequest.message}} | |
</li> | |
</ul> | |
</div> | |
</div> | |
<script src="/angular/angular.js"></script> | |
<script src="/horizon/horizon.js"></script> | |
<script> | |
angular.module('HelpApp', []) | |
.controller('HelpCtrl', function($scope) { | |
$scope.reset = function() { | |
$scope.newHelpRequest = {}; | |
} | |
$scope.getHelp = function(helpRequest) { | |
$scope.helpQueue.push(helpRequest); | |
$scope.reset(); | |
}; | |
$scope.newHelpRequest = {}; | |
$scope.helpQueue = [ | |
{ | |
name: 'Zeke', | |
message: 'Pretty confused...' | |
} | |
]; | |
}); | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment