好友
阅读权限10
听众
最后登录1970-1-1
|
我有个两个首页 我想通过不同的路由来加载不同的首页
在开发环境运行是可以的
发布之后在正式环境
就只能有哪个空路由的重定向有用的
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ChartsComponent } from './charts/charts/charts.component';
import { HomeComponent } from './home/home.component';
import { HomesComponent } from './homes/homes.component';
const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{ path: 'homes', component: HomesComponent },
{ path: 'charts', component: ChartsComponent },
{
path:'**',// 任意路由
component:HomesComponent
}
];
import { CardModule } from 'primeng/card';
import { ChartModule } from 'primeng/chart';
import { ToastModule } from 'primeng/toast';
import { ChartsComponent } from './charts/charts/charts.component';
import { HomeComponent } from './home/home.component';
import { HomesComponent } from './homes/homes.component';
@NgModule({
declarations: [
AppComponent,
ChartsComponent,
HomeComponent,
HomesComponent
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
FormsModule,
HttpClientModule,
NgZorroAntdModule,
ChartModule,
ToastModule,
CardModule
],
providers: [{ provide: NZ_I18N, useValue: zh_CN }],
bootstrap: [AppComponent]
}) |
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|