我的index.html中有:<div ui-view></div>
我的router.js主要部分:
myApp.config(["$stateProvider", '$urlRouterProvider',function($stateProvider,$urlRouterProvider){
$stateProvider.state('main',{
url: '/main',
templateUrl: 'views/main.html',
controller: 'mainCtrl'
})
$urlRouterProvider.otherwise('main');
}])为什么会出现:
输入url为:http://localhost:3000/main,页面中出现“Cannot GET /main ”控制台network查看http请求是404。必须加上index.html才能跳转到main ,即输入url:http://localhost:3000/index.html 自动跳转为http://localhost:3000/index.html#!/main,可以显示main.html的内容。为啥必须要带上index.html?