我一直在阅读并在Angular上做我的第一篇文章。
过了一会儿我就坚持了下来。简单的“Hello World”无效。
<html ng-app="myApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
</head>
<body>
<div ng-controller="GreetingController">
<p>{{greeting.text}}, world </p>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!-- Angular -->
<script type="text/javascript">
var myApp = angular.module('myApp',[]);
myApp.controller('GreetingController', ['$scope', function($scope) {
$scope.greeting = 'hey!!';
}]);
</script>
</body>
</html>
答案 0 :(得分:2)
此<p>{{greeting.text}}, world </p>
应为<p>{{greeting}}, world </p>
。