Created
December 12, 2014 18:21
-
-
Save lgdelacruz92/afe0f9286014daca288a to your computer and use it in GitHub Desktop.
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 ng-app="store"> | |
<head> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> | |
</head> | |
<body ng-controller="StoreController as store"> | |
<div class="list-group"> | |
<div class="list-group-item" ng-repeat="product in store.products"> | |
<h1>{{product.name}}</h1> | |
<h2>{{product.price}}</h2> | |
<p>{{product.description}}</p> | |
<button ng-show="store.products.canPurchase"> Add to Cart </button> | |
</div> | |
</div> | |
<script type="text/javascript" src="angular.min.js"></script> | |
<script type="text/javascript" src="app.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(){ | |
var app = angular.module('store', [ ]); | |
app.controller('StoreController', function(){ | |
this.products = gems; | |
}); | |
var gems = [ | |
{ | |
name: 'Dodecahedron', | |
price: 2.95, | |
description: 'My penis is horny', | |
canPurchase: true, | |
soldOut: false | |
}, | |
{ | |
name: 'Pentagon', | |
price: 30.45, | |
description: 'Pentagon has five sides', | |
canPurchase: true, | |
soldOut: true | |
} | |
]; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment