Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<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

Dismiss x
public
Bin info
StanleyMapro
0viewers