Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Routing inside the tabs in Ionic 4

$
0
0

@shubhamvo wrote:

I am trying to create the route inside the tabs. But I am not able to implement it. I have created the component inside one of my tab and I want to navigate to that component.
Below is my code

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';

import { IonicModule } from '@ionic/angular';

import { ReadingsPage } from './readings.page';
import { ReadingDetailComponent } from './pages/reading-detail/reading-detail.component';

const routes: Routes = [
  {
    path: '',
    children:[
      {
        path:'',
        component: ReadingsPage
      },
      {
        path:'detail',
        component:ReadingDetailComponent
      }
    ]
  }
];

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    RouterModule.forChild(routes)
  ],
  declarations: [ReadingsPage,ReadingDetailComponent]
})
export class ReadingsPageModule {}

I am trying to navigate to my url using following function:-

 showDetail(){
    this.router.navigate(['./detail'])
  }

Any help would be appreciated

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>