Siddharth Jain
Siddharth Jain

Reputation: 336

Angular 4 router not working with relative path

Angular 4 router works with absolute path like

loadChildren: 'app/dummy/dummy.module#DummyModule' }

But not working with following

 loadChildren: '../dummy/dummy.module#DummyModule' }

' PS:-I want to be worked with relative path How to achieve this in angular router

Upvotes: 0

Views: 75

Answers (2)

Krishna Rathore
Krishna Rathore

Reputation: 9687

You can use loadChildren: () =>

I have create a demo on Stackblitz

import { DummyModule } from './dummy/dummy.module';

{ path: 'path', loadChildren: () => DummyModule }

Upvotes: 1

Dhara Gadhiya
Dhara Gadhiya

Reputation: 111

You need to change in your code as below. Just remove one dot.

loadChildren: './dummy/dummy.module#DummyModule' }

This will help you.

Upvotes: 0

Related Questions