0
我想實現我的angular4應用簡單的路由deeplinking,但有一個問題與深層鏈接不工作..如何啓用angular4
例如,我有一個關於組件和主頁(待辦事項)組件,我app.routing.ts文件如下:
import { Routes, RouterModule } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';
import { TodosComponent } from './todos/todos.component';
import { AboutComponent } from './about/about.component';
import { CallbackComponent } from './callback/callback.component';
const appRoutes: Routes = [
{
path: '',
component: TodosComponent
},
{
path: 'about',
component: AboutComponent
},
{
path: 'callback',
component: CallbackComponent
}
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
現在導航工程,當我點擊從routerLink應用這些組件,但如果我直接輸入網址到瀏覽器,我得到一個404 ..
這是打破我的回調從我驗證來源:(
我的app.module.ts文件已導入路由器文件,但這仍然無法正常工作..我如何啓用深連接在這裏?
提示:404來自**服務器**。當您在地址欄中輸入時,您正在向服務器發送請求。 Angular在這裏無關緊要。閱讀https://stackoverflow.com/questions/26894769/understanding-what-it-takes-to-remove-the-hash-from-angular-routes/26897659#26897659。 –
https://angular.io/docs/ts/latest/guide/deployment.html#!#fallback – yurzui