Created
March 1, 2014 04:54
-
-
Save limichange/9285418 to your computer and use it in GitHub Desktop.
repeat
This file contains hidden or 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 lang="en" ng-app> | |
<head> | |
<meta charset="UTF-8"> | |
<title>test</title> | |
</head> | |
<body> | |
<div ng-controller="HelloController"> | |
<div ng-repeat="item in items"> | |
<div> | |
<span ng-bind="item.title"></span> | |
<span>-</span> | |
<span ng-bind="item.quantity"></span> | |
<span>-</span> | |
<span ng-bind="item.price | currency"></span> | |
<span>-</span> | |
<span><button ng-click="remove($index)">remove</button></span> | |
</div> | |
</div> | |
</div> | |
<div> | |
<form action="#" ng-submit="requestFunding()" ng-controller="StratUpController"> | |
Staring: <input ng-change="computeNeeded()" | |
ng-model="startingEstimate"> | |
Recommendation: <span ng-bind="needed"></span> | |
<button>Fund my startup!</button> | |
<button ng-click="reset()">Reset</button> | |
</form> | |
</div> | |
<script type="text/javascript" src="angular.min.js"></script> | |
<script type="text/javascript" src="main.js"></script> | |
</body> | |
</html> |
This file contains hidden or 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
function HelloController($scope, $location){ | |
$scope.items = [ | |
{title: 'title 1', quantity: 8, price: 3.94}, | |
{title: 'title 2', quantity: 7, price: 23.94}, | |
{title: 'title 3', quantity: 4, price: 33.94}, | |
]; | |
$scope.remove = function(index){ | |
$scope.items.splice(index, 1); | |
} | |
} | |
function StratUpController($scope){ | |
$scope.computeNeeded = function(){ | |
$scope.needed = $scope.startingEstimate * 10; | |
}; | |
$scope.requestFunding = function(){ | |
window.alert("Sorry, please get more customers first."); | |
} | |
$scope.reset = function(){ | |
$scope.startingEstimate = 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment