Skip to content

Commit f312041

Browse files
committed
Add builtin directives p2
1 parent 6ea087c commit f312041

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

angular-builtin-directive-p2/app.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Created by hoangnn on 29/10/2015.
3+
*/
4+
(function () {
5+
6+
var app = angular.module('Store', []);
7+
8+
app.controller('StoreController', function () {
9+
this.products = products;
10+
});
11+
12+
var products = [
13+
{
14+
name: 'Apple iPad Air 2 64G',
15+
price: 499,
16+
description: 'Apple iPad Air 2 ra mắt là chiếc máy tính bảng 9.7 inch mỏng và nhẹ nhất hiện nay',
17+
inStock: true
18+
},
19+
{
20+
name: 'Apple iPhone 6s',
21+
price: 599,
22+
description: 'Một bước ngoặt trong thiết kế của Apple vừa tinh tế, vừa sang trọng và thời thượng và những cải tiến đáng giá',
23+
inStock: false
24+
},
25+
{
26+
name: 'Apple iPhone 6s Plus',
27+
price: 699,
28+
description: 'Một bước ngoặt trong thiết kế của Apple vừa tinh tế, vừa sang trọng và thời thượng và những cải tiến đáng giá',
29+
inStock: true
30+
}
31+
]
32+
33+
})();
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!DOCTYPE html>
2+
<html ng-app="Store">
3+
<head lang="en">
4+
<meta charset="UTF-8">
5+
<title>angular-controller-example</title>
6+
7+
<!-- Vendor -->
8+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"
9+
integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ=="
10+
crossorigin="anonymous">
11+
</head>
12+
<body>
13+
14+
<div class="container">
15+
<div class="page-header"></div>
16+
<div class="panel panel-default col-md-5" ng-controller="StoreController as store">
17+
<div class="panel-body" ng-repeat="product in store.products">
18+
<h1>{{product.name}}</h1>
19+
20+
<h2>$ {{product.price}}</h2>
21+
22+
<p>{{product.description}}</p>
23+
<button class="btn btn-primary" ng-show="product.inStock">Thêm vào giỏ</button>
24+
</div>
25+
</div>
26+
</div>
27+
28+
29+
<!-- Vendor -->
30+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
31+
32+
<!-- Application -->
33+
<script src="app.js"></script>
34+
</body>
35+
</html>

0 commit comments

Comments
 (0)