如果我不包含$ urlRouterProvider.otherwise('/');在配置中。ui路由无urlRouterProvider.otherwise
与大猩猩我去App Engine的设置是
r := mux.NewRouter()
r.HandleFunc(/admin, handleAdmin)
和angularjs配置是;
angular.module('admin')
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider.state('home', {
url: '/',
templateUrl: '/admin/index.html',
controller: 'AdminController as admin'
});
//$urlRouterProvider.otherwise('/');
})
的时候我不叫$ urlRouterProvider.othwerwise行,我打开http://localhost:8080/admin我希望看到管理员/ index.html的,但我不知道。我只有在手动导航到http://localhost:8080/admin#/时才能看到它。 但是,如果我添加$ urlRouterProvider.othwerwise选项并转到http://localhost:8080/admin它会自动重定向到http://localhost:8080/admin#/ 我不认为这是通常的方式来做到这一点,因为我可能需要“否则”路由到自定义404页面。我错过了什么?
好吧我尝试了这一点,它的工作原理(尽管在控制台窗口中有很多错误),但我想要相同的功能,当我去http:// localhost在另一个模块负责,我使用ngNewRouter,它会自动重定向到http: // localhost:8080 /#/而html5未启用。 – nurp
http:// localhost:8080/admin#/ works但是http:// localhost:8080/admin /#/没有。 – nurp
您的应用程序必须有一个主模块,其中注入所有其他模块,并将其附加到该模块的配置功能,以使其在整个应用程序中运行。 –