Fireship · @fireship
Ionic 4 - Routing and Navigation Guide
Uploaded September 4, 2018 · Length 11:38
Summary
Ionic 4 routing and navigation guide using the angular router, including lazy loading and dynamic data routing.
- ionic 4 routing
- angular router
- lazy loading
- ionic navigation
- dynamic routing
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
[Music]
- 0:06
the single most important change in
- 0:08
ionic four is the way navigation works
- 0:10
if you're migrating from version three
- 0:12
then you're probably familiar with ionic
- 0:13
snap controller and the ion nap
- 0:15
component but they've been deprecated in
- 0:17
favor of the angular router which is far
- 0:19
more powerful in today's video you'll
- 0:21
learn everything you need to know to be
- 0:23
successful with the angular router in
- 0:25
ionic 4 and I'll show you a few advanced
- 0:27
techniques that you can start putting to
- 0:28
use right away if you're new here like
- 0:30
and subscribe and you can find the
- 0:32
source code at angular firebase com so
- 0:35
prior to ionic 4 the framework used its
- 0:37
own built in nav controller and
- 0:39
component to handle the navigation
- 0:40
between pages in a push pop style way
- 0:43
that you would see on a mobile
- 0:44
application I'd like to point out that
- 0:46
the nav controller will still
- 0:47
technically work in ionic 4 so you might
- 0:49
see some tutorials out there on the web
- 0:50
that use it but it's not the preferred
- 0:52
way to handle navigation and will likely
- 0:54
not be possible in the future I'm going
- 0:56
to go ahead and assume that you know
- 0:57
nothing about the angular router so
- 0:59
we'll start with the absolute basics and
- 1:01
then build up to some pretty advanced
- 1:02
concepts towards the end and also make
- 1:05
sure to watch my angular routing basics
- 1:07
video which is very relevant to the
- 1:08
topic at hand here
- 1:09
and before we do anything I want to give
- 1:11
you a pro tip and that is to install the
- 1:14
augury plugin for angular you can find
- 1:16
it on the chrome store and it will help
- 1:18
you a ton by visualizing your actual
- 1:20
router tree so you can see here that
- 1:22
everything kind of starts from the app
- 1:23
component then we have a couple of lazy
- 1:25
loaded pages and so on
- 1:27
this is a pretty basic set up here but
- 1:29
it becomes very valuable as your
- 1:31
complexity grows I've gone ahead and
- 1:34
generated a brand new ionic 4 app that's
- 1:36
using the tabs template and when we open
- 1:39
this application up the first place
- 1:40
we'll go is into the app directory and
- 1:43
then open the app routing module the
- 1:46
only thing you'll ever really change in
- 1:47
this file is the routes array which is
- 1:49
an array of objects where you define the
- 1:51
actual routes in your application there
- 1:53
are three basic types of routes that you
- 1:55
can define your typical vanilla route
- 1:57
would just be one that loads a component
- 1:59
then an ionic we have lazy loaded routes


