我有一个简单的 Angular7 应用程序,它只有两条路线,主要是“文章”。如果你在本地测试它,它会起作用,但是当你放到 github 页面上时,它只会加载页面的 css。我按照文档中的角度文档进行了部署,并且还尝试了 gh-pages 工具。但它们都不起作用。如果我删除我的路线它就会起作用。
这是我在控制台上遇到的错误。
1 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'blogfolio'
Error: Cannot match any routes. URL Segment: 'blogfolio'
at t.noMatchError (main.5443131190bc79920d7b.js:1)
at e.selector (main.5443131190bc79920d7b.js:1)
............
rodnorm.github.io/:1 Failed to load resource: the server responded with a status of 404 ()
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
应用程序.routing.ts
import { MainComponent } from './main/main.component';
import { ArticleComponent } from './article/article.component';
import { Routes } from "@angular/router";
export const routes: Routes = [ …Run Code Online (Sandbox Code Playgroud)