Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6ea087c

Browse files
Add builtin-directive tutorial
1 parent cb61dfd commit 6ea087c

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

‎angular-builtin-directive/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
angular-buildin-.iml

‎angular-builtin-directive/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+
})();

‎angular-builtin-directive/index.html

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)

AltStyle によって変換されたページ (->オリジナル) /