我无法在我的页面中实现 angularJS 路由,当我第一次制作它时,它有效,但浏览器什么也没有返回。 代码: http://plnkr.co/edit/lIXeC0X6SkzXKcr8hoAp?p=catalogue
应用程序:
angular.module('$routingApp', ['ngRoute'])
.config(['$routeProvider', function($routeProvider){
$routeProvider
.when('/', {
templateUrl: 'main.html'
})
.otherwise({
redirectTo: '/'
});
}]);
最佳答案
问题出在你的模块名称上,正如 @sp00m 所建议的,请参阅下面更新的 plunkr 链接:
angular.module('routingApp', ['ngRoute'])
.config(['$routeProvider', function($routeProvider){
$routeProvider
.when('/', {
templateUrl: 'main.html'
})
.otherwise({
redirectTo: '/'
});
}]);
关于javascript - AngularJS 路由不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35079878/