Last active
August 29, 2015 14:04
-
-
Save JacobHsu/84e6de8fa268cbfbba19 to your computer and use it in GitHub Desktop.
#angular.js :BUILT-IN DIRECTIVES
This file contains 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="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> |
This file contains 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('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