Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!doctype html>
<html lang="en" ng-app>
<meta charset="UTF-8">
<div ng-controller="HelloController">
<div ng-repeat="item in items">
<span ng-bind="item.title"></span>
<span ng-bind="item.quantity"></span>
<span ng-bind="item.price | currency"></span>
<span><button ng-click="remove($index)">remove</button></span>
<form action="#" ng-submit="requestFunding()" ng-controller="StratUpController">
Staring: <input ng-change="computeNeeded()"
Recommendation: <span ng-bind="needed"></span>
<button>Fund my startup!</button>
<button ng-click="reset()">Reset</button>
<script type="text/javascript" src="angular.min.js"></script>
<script type="text/javascript" src="main.js"></script>
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
You can’t perform that action at this time.