angularjs - Referencing local angular.js does not work -
i'm beginning work angularjs , having trouble working local copy of angular.js file. below sample trying work. when reference cdn script, page correctly displays 'hello, world'. when reference local script, binding not occur. browser able locate local angular.js file, doesn't seem perform binding.
<html ng-app> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.4/angular.js"></script> <!--<script src="scripts/angular.js"></script>--> <script> function hellocontroller($scope) { $scope.greeting = { text: "hello" }; } </script> </head> <body> <div ng-controller="hellocontroller"> <p>{{greeting.text}}, world</p> </div> </body> </html>
if starting out 1.3.15 this:
<html ng-app="main.app"> <head> <script src="https://code.angularjs.org/1.3.15/angular.js"></script> <script> angular.module('main.app', []) .controller('hellocontroller', function () { var self = this; this.greeting = { text: "hello" }; }) </script> </head> <body ng-controller="hellocontroller helloctrl"> <p>{{helloctrl.greeting.text}}, world</p> </body> </html>
this follows latest styles of angular coding
Comments
Post a Comment