i'm copying code egghead.io tutorial isn't working. angular expression isn't posting view (it posts {{}} rather evaluating). works if remove ng-controller <body> , value "app" ng-app in <html> can't figure out pinpont problem. i've tried moving script angular module/controller on html page (header, bottom of page, etc.) , no luck.
as side question i'm wondering if stackoverflow proper place post this. supposedly you're not supposed use 'code-review' tag , reviews of "other-wise working code" belongs on codereview.stack. code working sooo...
<!doctype html> <html ng-app="app"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"> </script> <script> angular.module("app", []) .controller(firstctrl, function firstctrl()[ var first = this; first.greeting = "first"; ]) </script> </head> <body ng-controller="firstctrl first"> <input type="text" ng-model="first.greeting"/> <div ng-class="first.greeting"> {{first.greeting}} {{world}} </div> </body> </html>
<!doctype html> <html ng-app="app"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"> </script> <script> angular.module("app", []) .controller("firstctrl", [ function () { var first = this; first.greeting = "first"; } ]) </script> </head> <body ng-controller="firstctrl first"> <input type="text" ng-model="first.greeting"/> <div ng-class="first.greeting"> {{first.greeting}} {{world}} </div> </body> </html> i made slight change code.
the controller name needed double qoutes around see "firstctrl" had missing square bracket , closing bracket. copy , past above code should work.
it works me. :)
Comments
Post a Comment