<html ng-app="store">
<head>
<meta name="description" content="AngularJS directivesExample 4">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
<meta charset="utf-8">
<title>AngularJS directivesExample 4</title>
</head>
<body>
<div ng-controller="StoreController as store" ng-hide="products.soldOut">
<div ng-repeat="product in store.products">
<h1>{{ product.name }}</h1>
<img src="{{ product.images[0].full }} " width="200">
<h2>NT${{ product.price }}</h2>
<p>{{ product.description }}</p>
<button ng-show="product.buttonShow">加入購物車</button>
</div>
</div>
</body>
</html>
(function(){
var app = angular.module('store',[]);
app.controller('StoreController',function(){
this.products = items;
});
var items = [
{
name:"馬老師雲端研究室 滑鼠墊",
price:"350",
images:[
{
full:"http://macloudlab.com/my/AngularJS/images/products/mousePadBig.jpg",
small:"http://macloudlab.com/my/AngularJS/images/products/mousePadSmall.jpg"
}
],
description:"有些人認為滑鼠墊就只是種簡單的產品。無非是將滑鼠放於上方並將之滑來拖去。 “表面”上來說確實如此(一語雙關)。但實際上,製造能帶來卓越遊戲體驗的滑鼠墊卻需要結合眾多科學、技術和工藝。身為遊戲滑鼠技術的世界領先者,對如何使滑鼠感測器高效運作我們獨樹一幟。運用專門知識來製造適合的滑鼠墊表面,讓滑鼠感測器得以作出高效而精確的反應。",
buttonShow:true,
soldOut:false,
},
{
name:"馬老師雲端研究室 馬克杯",
price:"450",
images:[
{
full:"http://macloudlab.com/my/AngularJS/images/products/cupBig.jpg",
small:"http://macloudlab.com/my/AngularJS/images/products/cupSmall.jpg"
}
],
description:"馬克杯是家中常見杯子的一種,一般用於牛奶,咖啡,茶類熱飲。西方一些國家也有用馬克杯在工作休息時喝湯的習慣。杯身一般為標準圓柱形或類圓柱形並且杯身的一側帶有把手。把手形狀通常為半環。通常材質為純瓷,釉瓷,玻璃,不鏽鋼或塑料。也有少數馬克杯由天然石製成,一般價格較高。",
buttonShow:true,
soldOut:false,
}
];
})();
Output
300px
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |