如果我不包含$ 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
您的應用程序必須有一個主模塊,其中注入所有其他模塊,並將其附加到該模塊的配置功能,以使其在整個應用程序中運行。 –