Angularjs 路由不工作,也无法加载html视图

Angularjs 路由不工作,也无法加载html视图,angularjs,routes,Angularjs,Routes,任何人都可以帮助,路由不工作,也无法加载html视图 有人能帮忙吗,Route不起作用,也无法加载html视图。在您的Plunkr中,您正在重新定义HallApp,因此您的routes消失了: var hallApp = angular.module("hallApp",['ngRoute']); // <- first define hallApp.config(...); hallApp.controller('homeCtrl', ['$scope', function($sc

任何人都可以帮助,路由不工作,也无法加载html视图


有人能帮忙吗,Route不起作用,也无法加载html视图。在您的Plunkr中,您正在重新定义HallApp,因此您的routes消失了:

var hallApp = angular.module("hallApp",['ngRoute']); // <- first define

hallApp.config(...);

hallApp.controller('homeCtrl', ['$scope', function($scope) {
  $scope.greeting = 'Home!';
}]);

var hallApp = angular.module('hallApp', []); // <- second define
hallApp.controller('newCtrl', function($scope) {
 // create a message to display in our view
 $scope.message = 'Everyone come and see how good I look!';
});

有不同的意思。第一个创建一个新模块,第二个返回对现有模块的引用。因此应该只有一个使用相同字符串的模块调用(字符串、数组)

var hallApp = angular.module("hallApp",['ngRoute']); // <- first define

hallApp.config(...);

hallApp.controller('homeCtrl', ['$scope', function($scope) {
  $scope.greeting = 'Home!';
}]);

var hallApp = angular.module('hallApp', []); // <- second define
hallApp.controller('newCtrl', function($scope) {
 // create a message to display in our view
 $scope.message = 'Everyone come and see how good I look!';
});
angular.module('app', [])
angular.module('app')