Skip to content

Instantly share code, notes, and snippets.

@lgdelacruz92
Created December 12, 2014 18:21
Show Gist options
  • Save lgdelacruz92/afe0f9286014daca288a to your computer and use it in GitHub Desktop.
Save lgdelacruz92/afe0f9286014daca288a to your computer and use it in GitHub Desktop.
<!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>
(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