Nativescript navigation named router-outlet nested lazy loading with TabView


#1

Hy guys,

i have problem with navigation and lazyLoading

app.routing.ts

const routes: Routes = [
    {
        path: "tabs" ,
        loadChildren: "./tabs/tabs.module#TabsModule"
    }
 ];



tabs.routing.ts

const routes: Routes = [
    { 
        path: "", 
        component: TabsComponent
    },
    {path: 'products',loadChildren: "./tabs/products.module#ProductsModule"}


tabs.component.ts

 if (tabView.selectedIndex == 0) {
   this.routerExtensions.navigate(['tabs',
                   {
                      outlets: {
                        'products': ['products'],
                       }
                  }]);
}





products.routing.ts

export const routes = [
    {      
        path: "", component: ProductsComponent ,outlet:"products"
    }
];

but browsing with the router-outlet does not work.
Can you explain the reason?

if I use this the router-outlet works

  { 
        path: "", 
        component: TabsComponent,
        children:[
            {path: '', redirectTo: 'products', pathMatch: 'full'},
            { path: 'products',loadChildren: "./tabs/products-tab/products/list-products/list-products.module#ListProductsModule" }
        ]
    },

Thanks All


#2

I have the same problem… have YouTube found any solution?


#3

Which version of angular you are using? Try changing router-outlet to

page-router-outlet name=“products”


#4

Angular 5.2.0… I have 2 router-outlet in a tabView inside a page-router-outlet.


#5

Hi,

i solved

home route

{ path: 'tabs',component: TabsComponent,loadChildren: "./tabs/TabsComponent.module#TabsComponentModule" }

tab route

{ path: 'products',loadChildren: ".products.module#ProductsModule" }

products route

{ path: 'products',component:ProductsComponent,outlet:'products' }

#6

@alexma01 you have this example in github of how you solved the problem. I would appreciate it, please.


#7

I also want example for nested modules as above
please can you provide me link?

@alexma01