1
Hello, I’m following a codeschool course on Angular and all the examples I do with Angular do not work, are very simple thing. I’m gonna post the code so someone can tell me what I’m doing wrong.
// app.js
(function () {
var app = angular.module('store', []);
app.controller('StoreController', function () {
this.product = gem;
});
var gem = {
name: 'Dodecahedron',
price: 2.95,
description: 'Alguma descrição',
}
})();
<!--index.html-->
<!DOCTYPE html>
<html>
<head ng-app="store">
<meta charset="UTF-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<title></title>
</head>
<body>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
<div ng-controller="StoreController as store">
<h1> {{store.product.name}} </h1>
<h2> {{store.product.price}} </h2>
<p> {{store.product.description}} </p>
</div>
</body>
</html>
The result that’s coming out is this:
{{store.product.name}}
{{store.productprice.}}
{{store.product.Description}}
Can someone help me? Thank you.
It worked! Thank you very much!
– Tiago Taraczuk