0
我有下面的代碼角2路線不重裝組件
{
path: 'clientReports',
component: ClientsRootComponent,
children: [
{
path: ':reportId',
component: ClientsReportComponent,
children: [
{
path: ':countryId/:branchId',
component: ClientsGridComponent,
}
]
}
]
}
及以下鏈接
app/clientReports/1/1/1
app/clientReports/2/1/1
app/clientReports/3/1/1
每當我點擊一個鏈接,我可以看到ClientsReportComponent
不會重新加載,而是存在一個被重用並導致我在該組件的提供程序中聲明的服務生存期問題。
不應該是組件ClientsReportComponent
每次點擊一個新的鏈接時重新加載?
ClientsRootComponent有一些服務注入,我需要銷燬和重用。因此,重用組件對我來說至關重要 – pantonis
在這種情況下,你不能使用EventEmitter並從父組件訂閱? – rijin
有沒有什麼方法可以覆蓋這種行爲? – pantonis