Skip to content

Instantly share code, notes, and snippets.

@JacobHsu
Last active August 29, 2015 14:04
Show Gist options
  • Save JacobHsu/84e6de8fa268cbfbba19 to your computer and use it in GitHub Desktop.
Save JacobHsu/84e6de8fa268cbfbba19 to your computer and use it in GitHub Desktop.
#angular.js :BUILT-IN DIRECTIVES
<!DOCTYPE html>
<html ng-app="gemStore">
<head>
<link rel="stylesheet" type="text/css" href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" />
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script>
</head>
<body class="container" ng-controller="StoreController as store">
<div class="product row" ng-repeat="product in store.products">
<h3>
{{product.name}}
<em class="pull-right">${{product.price}}</em>
</h3>
</div>
</body>
</html>
(function() {
var app = angular.module('gemStore', []);
app.controller('StoreController', function(){
this.products =gems;
});
var gems = [
{ name: 'Azurite', price: 2.95 },
{ name: 'Bloodstone', price: 5.95 },
{ name: 'Zircon', price: 3.95 },
];
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment