javascript - AngularJS ng-repeat does not render -


i practicing angularjs.

my problem :ng-repeat not repeat array.

index.html:

<!doctype html> <html ng-app="store">   <head>     <link rel="stylesheet" type="text/css" href="node_modules/bootstrap/dist/css/bootstrap.min.css" />     </head>   <body ng-controller="storecontroller store">     <div ng-repeat="product in store.products">       <h1> {{product.name}}</h1>       <h2> ${{product.price}}</h2>       <p> {{product.description}} </p>       <button ng-show="product.canpurchase">add cart</button>     </div>     <script type="text/javascript" src="node_modules/angular/angular.min.js"></script>     <script type="text/javascript" src="app.js"></script>   </body> </html> 


app.js:

(function(){     var app = angular.module('store', []);     var gems = [{name: 'dodecahedron',          price: 2.95,          description: 'hidden mass',          canpurchase : true,          soldout : true},         {name: 'pentagonal gem',          price: 5.95,          description: 'vacuum mass',          canpurchase : false,          soldout : false}            }];     app.controller('storecontroller', function(){     this.products = gems;     }); })(); 

can tell me fault is?

you provided }

here

    {name: 'pentagonal gem',      price: 5.95,      description: 'vacuum mass',      canpurchase : false,      soldout : false} <- here        }]; 

remove that

{   name: 'pentagonal gem',   price: 5.95,   description: 'vacuum mass',   canpurchase: false,   soldout: false  }]; 

demo


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -