有人能告诉我为什么这个掠夺者不能工作吗? Sample AngularJS on Plunker
HTML:
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.6/angular.min.js"></script>
<script src="script.js"></script>
</head>
<body ng-controller="MyCtrl">
<p>{{userData}}</p>
</body>
</html>
JavaScript的:
var app = angular.module('myApp', []);
app.controller('MyCtrl', function ($scope) {
$scope.userData = {
name: 'Xavier',
age: 25
}
});
答案 0 :(得分:1)
你忘了把ng-app。
<html ng-app="myApp">