在angular1.3.0中,您必须执行以下操作,因为在1.3.0-beta中禁用了Global控制器。参考
<div ng-app="myApp" ng-controller="personController"><script>var app = angular.module("myApp",[]);app.controller('personController', function($scope){ $scope.firstName = "David"; $scope.lastName = "Silva";})</script>它还说您可以通过使用以下代码来获得较早的行为, 但不建议这样做
<div ng-app="myApp" ng-controller="personController">var app = angular.module("myApp",[]).config(['$controllerProvider', function($controllerProvider) { $controllerProvider.allowGlobals();}]);function personController($scope) { $scope.firstName = "David"; $scope.lastName = "Silva";}


