dimanche 1 mars 2015

Angular controller not updating


I am starting an O'Reilly book, AngularJS and the first example is as follows. On my end the "{{greeting.text}}" is showing up as that inside of being replaced with hello. I have the angular linked properly, and when I put it into jsFiddle it doesn't work as well, unless I change onLoad to no wrap- then it works.


I am using Webstorm on mac and I'm thinking my problem may be in there, but can't find anything that has fixed it.


Thank you for helping what is probably a simple solution.


HTML



<!DOCTYPE html>
<html ng-app>
<head lang="en">
<script src="angular.js"></script>
<script src ="controllers.js"></script>
</head>
<body>
<div ng-controller="HelloController">
<p>{{greeting.text}}, World</p>
</div>

</body>
</html>


Controller



function HelloController($scope) {
$scope.greeting = { text: 'Hello'};
}




Aucun commentaire:

Enregistrer un commentaire