Created
June 16, 2020 12:48
-
-
Save simplyniceweb/c2b91a109a083c0848490fe0e5ee286a to your computer and use it in GitHub Desktop.
ionic homepage with tabs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from '@angular/core'; | |
import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; | |
import { MenuPage } from './pages/menu/menu.page'; | |
const routes: Routes = [ | |
{ | |
path: '', | |
loadChildren: './home/home.module#HomePageModule' | |
}, | |
{ | |
path: 'menu', | |
component: MenuPage, | |
children: [ | |
{ | |
path: 'first', | |
loadChildren: './pages/first/first.module#FirstPageModule' | |
}, | |
{ | |
path: 'second', | |
loadChildren: './pages/second/second.module#SecondPageModule' | |
} | |
] | |
}, | |
// { path: 'menu', redirectTo: '/menu/first' } | |
]; | |
@NgModule({ | |
imports: [ | |
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) | |
], | |
exports: [RouterModule] | |
}) | |
export class AppRoutingModule { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { Router } from '@angular/router'; | |
@Component({ | |
selector: 'app-home', | |
templateUrl: './home.page.html', | |
styleUrls: ['./home.page.scss'], | |
}) | |
export class HomePage implements OnInit { | |
constructor(private router: Router) {} | |
ngOnInit() { | |
setTimeout(() => { | |
this.router.navigateByUrl('/menu/first'); | |
}, 2000); //2s | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment