I'm working through an angular tutorial and I have this output on the actual page: {{product.name}} ${{product.price}}
my html and js are below
<!DOCTYPE html>
<html ng-app="gemStore">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.10/angular.min.js"></script>
<script type="text/javascript" src="app.js"></script>
</head>
<body class="container" ng-controller="StoreController as store">
<div class="product row" ng-repeat='product in store.products'>
<h3>
{{product.name}}
<em class="pull-right">${{product.price}}</em>
</h3>
</div>
</body>
</html>
and next the js
(function() {
var app = angular.module('gemStore', ['bootstrap-tagsinput']);
app.controller('StoreController', function(){
this.products= gems;
});
var gems = [
{ name: 'Azurite', price: 2.95 },
{ name: 'Bloodstone', price: 5.95 },
{ name: 'Zircon', price: 3.95 },
];
})();
Any help on how to actually display the contents of product.name would be appreciated. Also why is the html not recognizing these braces {{}} and displaying java script for them?
var app = angular.module('gemStore', ['bootstrap-tagsinput']);StoreController as storebut then are referencing aproductwhich isn't your controller, nor is it a property on yourStoreController, so it's not clear where that is supposed to come from? I think you are missing an ng-repeat element here, something likeng-repeat = "product in store.gems"