I've just started learning angular.js . I wrote a basic controller in app.js file and set its property. I'm trying to access this data inside html page but in vain. Controller property values are not getting shown in webpage. Below is the code :
app.js :
(function(){
var app = angular.module('gemStore',[]);
var gem = {name: 'Diamond', price: 120, description: 'Hard'};
app.controller('StoreController', function() {
this.product = gem;
});
})();
index.html
<!DOCTYPE html>
<html ng-app="gemStore">
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js" ></script>
<script type="text/javascript" src="js/app.js" ></script>
<p> {{"Hello, Angular!"}}</p>
<div ng-controller="StoreController as store">
<h1>{{store.product.name}}</h1>
<h2>{{store.product.price}}</h2>
<h3>{{store.product.description}}</h3>
</div>
</body>
</html>
Please tell me where am i going wrong!!