javascript - AngularJS project configuration -
i'm trying make first angularjs project. i'm having problems project configuration. first created java project angularjsexample. converted angularjs project.i have configured script paths tern projects. hello.html doesn't know greeting. can please tell me why?
these files:
<html ng-app> <head> <script src="angular.js"></script> <script src="controllers.js"></script> </head> <body> <div ng-controller='hellocontroller'> <p>{{greeting.text}}, world</p> </div> </body> </html> var mycontroller = angular.module('myapp',[]); mycontroller.controller('hellocontroller', ['$scope', function($scope) { $scope.greeting ={ text : 'hello' }; }]);
assuming you're using current stable version of angularjs, 1.2.25, need add app name ng-app
directive. so, markup must be:
<html ng-app="myapp">
Comments
Post a Comment