简体   繁体   中英

this.router.navigate(['components/NewComponent']); is not working

I have created new component in my project dashboard. the project path is like ~src\\app\\layout\\dashboard\\components\\New-Component

and i have added routing in my dashboard routing module like

import { NewComponentComponent } from './components/New Component/New-Component.component';

{ path: 'components/New-Component', component : NewComponentComponent} .

i have called this page from dashboard chart component.

onChartClick(e) {         
        this.router.navigate(['components/New-Component']);
    }

When i clicked on chart it is navigated to New component page but it displays same dashboard page. http://localhost:4200/dashboard/components/New-Component .

添加/在组件之前

this.router.navigate(['/components/New-Component']);

Thank you all of you for your help.

for this i have used this.router.navigate(['../components/New-Component']);

It is working now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM