Routing

The previous chapter was a monster, but it was needed to give you a couple of crash courses on two of the technologies you're likely to use, or should definitely consider using, in your web development projects (and this is true whether or not your project leverages Angular). Additionally, Chapter 3, Bootstrap – Grid Layout and Components, was also there to help set the stage for the rest of the book.

This chapter is much smaller by comparison, but it marks the true beginning of our journey into Angular. Each chapter from this point forward, even Chapter 12, Integrating Backend Data Services, where the primary focus is on building backend services in Node and MongoDB, has Angular material in it (specifically, how to use Angular's HTTP client and how to wrap your code up in an Angular service).

One other note about this chapter that I'd like to point out is that most books on Angular don't introduce routing before they introduce Angular templates and components, which is fine; but we won't be following that approach. Although routing and component templates are inextricably linked together, which is the the likely reason that most books discuss routing after components, understanding components is not at all a prerequisite for understanding routing.

More generally, most programming books try and present all the material and concepts in advance, and then circle back at a later time to try and implement them in some fashion. One of the problems with this approach is that it goes against the way our brains work when assimilating and internalizing new information. It is usually better to immediately use new information, in small incremental steps.

This book focuses on being as practical as possible, as soon as possible, and in a way that maximizes the retention and understanding of new material. So, in order to accomplish this, we'll be building our example application together throughout the book, learning the topics as we need them, and not before. This means that we will often implement things that haven't yet been fully explained. They will be explained to you as we implement them, or immediately afterwardwhen your brain is primed, and looking for patterns to forment understanding.

So, don't worry about diving in head first—it's usually the best way. I'm your guide and I am with you to all the way to the end of the book.

Here is what we'll be covering together in this chapter:

  • Defining what routing is, for Angular applications
  • Creating the shell of our application, as well as its first few components, using the CLI
  • Configuring routing for our application
  • Taking a look at route redirection, parameterized routes, and route guards
  • Completing the routing configuration for our application
  • Taking a look at routing strategies

There's quite a bit to cover (even for a small chapter such as this one), so let's get started!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.123.252