javascript - angular expressions not being evaluated by browser -


i using angular in php. have copied angular.js file project , reference it. below project: (yes codeschool tutorial).

index.html (html5)

<!doctype html> <html ng-app="store" > <head>     <meta charset="utf-8">     <link rel="stylesheet" type="text/css" href="dist/vendors/twitter/css/bootstrap.min.css">     <script type="text/javascript" src="dist/vendors/angular/angular.js"></script>     <title>flatlanders gems</title> </head> <body >      <div ng-controller="storecontroller">             <h1> {{storecontroller.product.name}} </h1>             <h2> {{storecontroller.product.price}} </h2>             <p> {{storecontroller.product.description}} </p>     </div>  <script type="text/javascript" src="dist/js/app.js"></script>  </body> </html> 

and app.js

(function () {     var ap = angular.module('store', []);     app.controller('storecontroller', function () {         this.product = gem;     });     var gem = {         name:'dodecahedron',         price: 2.95,         description: '...'     } })(); 

code completion works in phpstorm. interestingly, storecontroller not display product, product display name price , description elements

here directory structure: enter image description here when run app either php or directy in browser (using xamp) following:

and here output enter image description here

i same results whether use angular 1.4 or 1.5

it appears not seeing either app.js or angular.js (or there else missing?) have tried references beginning with:

/dist
./dist ,
~/dist
same result.

look @ variable name of module in app.js file. put ap when use app create controller.

var ap = angular.module('store', []); app.controller('storecontroller', function () {     this.product = gem; }); 

instead of

var app = angular.module('store', []); app.controller('storecontroller', function () {     this.product = gem; }); 

or

var ap = angular.module('store', []); ap.controller('storecontroller', function () {     this.product = gem; }); 

so correct var name , work.


Comments