目前,当我从如下路由刷新页面时:
它仍停留在同一路由上。但是我希望该路由重定向到:
我看到有人问如何实现保持在相同路由的刷新。所以,我猜想,默认情况下Angular应该在浏览器刷新时将其重定向到主页。任何想法为什么我的Angular默认项目会出现这种情况吗?
下面是我的AppRoutingModule:
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { SmileyFeedbackComponent } from '../smiley-feedback/smiley-feedback.component';
import { FeedbackFormComponent } from '../feedback-form/feedback-form.component';
import { ThankYouComponent } from '../thank-you/thank-you.component';
const routes: Routes = [
{ path: '', redirectTo: '/smiley', pathMatch: 'full' },
{ path: 'smiley', component: SmileyFeedbackComponent },
{ path: 'feedback', component: FeedbackFormComponent },
{ path: 'thank-you', component: ThankYouComponent }
];
@NgModule({
imports: [
RouterModule.forRoot(routes)
],
exports: [ RouterModule ],
declarations: []
})
export class AppRoutingModule { }