代码:
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<script src="../node_modules/angular/angular.js"></script>
</head>
<body>
<div ng-app ng-controller="HelloCtrl">
Your name: <input type="text" ng-model="name" placeholder="World">
<hr>
Hello {{name}}!
</div>
<script>
var HelloCtrl = function($scope){
$scope.name = 'world';
}
</script>
</body>
</html>
一个angular的例子,但是总是报错:
Error: [ng:areq] Argument 'HelloCtrl' is not a function, got undefined
http://errors.angularjs.org/1.3.15/ng/areq?p0=HelloCtrl&p1=not%20a%20function%2C%20got%20undefined
at REGEX_STRING_REGEXP (angular.js:63)
at assertArg (angular.js:1587)
at assertArgFn (angular.js:1597)
at angular.js:8470
at angular.js:7638
at forEach (angular.js:331)
at nodeLinkFn (angular.js:7625)
at compositeLinkFn (angular.js:7117)
at publicLinkFn (angular.js:6996)
at angular.js:1457
不知道是为何~~?