오늘 Angular.js 내 첫 날, 나는 기본 컨트롤러에 붙어 :잉 반복 기능 나던 작업
내 APP.js
(function()
{ var app = angular.module('store', [ ]);
app.controller('StoreController', function()
{
this.product = gem;
});
var gem = [
{name:'John', price:25, description:'boy',soldout: false,canpurchase:true},
{name:'Kohn', price:25, description:'boy',soldout: false,canpurchase:true}
]
//not mentioned:false
})();
index.HTML 사용
<!DOCTYPE html>
<html ng-app="store">
<script src="js/angular.min.js" type="text/javascript"></script>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<title>Purple</title>
</head>
<body ng-controller = "StoreController as store">
<script src="js/app.js" type="text/javascript"></script>
<h1>{{"Create your CV"}}</h1>
<div ng-repeat="products in store.product">
<div ng-hide="store.product.soldout">
<h1> {{store.product.name}} </h1>
<h2><em class="pull-right">{{store.product.price | currency}}</em></h2>
<h3> {{store.product.description}} </h3>
<button ng-show = "store.product.canpurchase"> Add to cart </button>
</div>
</div></body></html>
ng-repeat를 선택하지 않고 각 항목을 배열로 표시하면 디스플레이가 표시되지만 "ng-repeat"가 아닌 경우 코드가 정상적으로 작동하지만 NG - 반복이 작동하지 않습니다. 나는 무엇을 놓치고 있습니까?
부정적이 표시 해달라고하세요, 내가 바이올린에이 질문을
코드를 요청하기 전에 많은 연구를했을 : http://jsfiddle.net/68Dkz/2/
에
ng-repeat
내의 개별 항목이다, 나는 확신 당신이해야 'store '대신'products'를 사용하십시오. 'store.product.name' 대신'products.name'을 시도하십시오 – SharkofMirkwood