我知道命令「ng serve」在內存中創建了我所有的東西。Angular CLI - ng服務
現在我有這樣的網址:http://localhost:4200/some-angular-route 但我想這個網址:http://localhost:4200/子 /一些棱角路線
我的問題是如何創造這樣的「子」?我的問題是,在我的生產環境中,請求通過Spring Boot Zuul發送,並且在URL中有前綴。
我知道命令「ng serve」在內存中創建了我所有的東西。Angular CLI - ng服務
現在我有這樣的網址:http://localhost:4200/some-angular-route 但我想這個網址:http://localhost:4200/子 /一些棱角路線
我的問題是如何創造這樣的「子」?我的問題是,在我的生產環境中,請求通過Spring Boot Zuul發送,並且在URL中有前綴。
如下
@NgModule({
imports: [
RouterModule.forRoot(routes)
],
declarations: [AppComponent],
providers: [{ provide: APP_BASE_HREF, useValue: '/urlPrefix' }]
})
export class AppModule { }
此外,當你建立你的代碼,你可以給--directory和--baseHref如下您可以設置基本href。
ng build --d /mySubFolder/ --bh /urlPrefix/
謝謝,這對我很有用。 –
你有沒有看看角路由? https://angular.io/guide/router – Tom