在html框中添加以下代码,它将按原样运行
<div ng-app="myapp" data-ng-controller='Ctrl'>
<h1> Header </h1>
<h3> {{test}} </h3>
</div>
<script>
var app = angular.module('myapp', []);
app.controller('Ctrl', function($scope){
$scope.test = "Hello";
});
</script>
现在将JavaScript移至JavaScript框
var app = angular.module('myapp', []);
app.controller('Ctrl', function($scope){
$scope.test = "Hello";
});
它开始给出错误:未捕获错误:没有模块:myapp
我不想在html部分写任何内容,任何修复?