Skip to content

Instantly share code, notes, and snippets.

View codeaholicguy's full-sized avatar
🎯
Focusing

Nguyễn Nhật Hoàng codeaholicguy

🎯
Focusing
View GitHub Profile
<div ng-controller="StoreController as store">
<h1>{{store.product.name}}</h1>
<h2>$ {{store.product.price}}</h2>
<p>{{store.product.description}}</p>
</div>
var tablet = {
name: 'iPad Air 2 64G',
price: 499,
description: 'The newest Apple iPad.'
}
(function() {
var app = angular.module('Store', []);
app.controller('StoreController', function() {
this.product = tablet;
});
var tablet = {
name: 'iPad Air 2 64G',
price: 499,
<div ng-controller="StoreController as store">
<h1>{{store.product.name}}</h1>
<h2>$ {{store.product.price}}</h2>
</div>
<p>{{store.product.description}}</p>
<html ng-app="Store">
<!DOCTYPE html>
<html>
<body>
<script src="angular.min.js"></script>
<script src="app.js"></script>
</body>
</html>
<body ng-controller="MyController">
<script src="angular.min.js"></script>
</body>
<!DOCTYPE html>
<html ng-app="tutorial">
</html>
reviews: [
{
stars: 5,
body: "I love this product!",
author: "hoangn@codeaholicguy.com"
},
{
stars: 1,
body: "This product sucks",
author: "bob@hater.com"
<blockquote ng-repeat="review in product.reviews">
<b>Stars: {{review.stars}}</b>
{{review.body}}
<cite>by: {{review.author}}</cite>
</blockquote>