我正在尝试运行这个教程的AngularJS示例,控制台说:未捕获错误:[$ injector:modulerr]
问题出在哪里?
<div class="container" data-ng-app="demoApp">
<div>
<h3>Adding Module Configuration and Routing</h3>
<div data-ng-view=""></div>
</div>
</div>
<script src="angular-1.2.3/angular.min.js"></script>
<script src="angular-1.2.3/angular-route.min.js"></script>
<script>
var demoApp = angular.module('demoApp', ['ngRoute']);
demoApp.config(function ($routeProvider) {
$routeProvider
.when('/',
{
controller: 'SimpleController',
templateUrl: urlBase + '7. Partial1.html'
})
.when('/partial2',
{
controller: 'SimpleController',
templateUrl: 'Partial/view1.html'
})
.otherwise({ redirectTo: '/' });
});
demoApp.controller('SimpleController', function ($scope) {
$scope.customers = [
{ name: 'Dave Jones', city: 'Phoenix' },
{ name: 'Jamie Riley', city: 'Atlanta' },
{ name: 'Heedy Wahlin', city: 'Chandler' },
{ name: 'Thomas Winter', city: 'Seattle' }
];
});
</script>
答案 0 :(得分:5)
您需要从=""
属性中删除ng-view
。