in angular 1.3.0 u have to do like below, Because Global controllers were disabled in 1.3.0-beta. reference
<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>
It also said that you can get the older behavior by using below code , but its not recomended
<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";
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…