[英]this.router.navigate(['components/NewComponent']); is not working
我在我的項目儀表板中創建了新組件。 項目路徑就像 ~src\\app\\layout\\dashboard\\components\\New-Component
我在儀表板路由模塊中添加了路由,例如
import { NewComponentComponent } from './components/New Component/New-Component.component';
{ path: 'components/New-Component', component : NewComponentComponent}
.
我從儀表板圖表組件調用了這個頁面。
onChartClick(e) {
this.router.navigate(['components/New-Component']);
}
當我點擊圖表時,它被導航到新組件頁面,但它顯示相同的儀表板頁面。 http://localhost:4200/dashboard/components/New-Component 。
添加/在組件之前
this.router.navigate(['/components/New-Component']);
謝謝大家的幫助。
為此,我使用了this.router.navigate(['../components/New-Component']);
它現在正在工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.