About me. Routing into the Sunset with Angular. Manfred Steyer SOFTWAREarchitekt.at Trainer & Consultant Focus: Angular Google Developer Expert (GDE)

Similar documents
Frontend Web Development with Angular. CC BY-NC-ND Carrot & Company GmbH

By the end of this Angular 6 tutorial, you'll learn by building a real world example application:

Advanced Angular & Angular 6 Preview. Bibhas Bhattacharya

One Framework. Angular

Setting up an Angular 4 MEAN Stack (Tutorial)

Integrating Angular with ASP.NET Core RESTful Services. Dan Wahlin

Learn to Build Awesome Apps with Angular 2

About me. Google Developer Expert Telerik Developer Expert Digital

Upgrading to Ionic 3 APPENDIX D. Angular 4

Cross-Platform Mobile-Entwicklung mit dem Ionic Framework

Advantages: simple, quick to get started, perfect for simple forms, don t need to know how form model objects work

Lab 1 - Introduction to Angular

Angular 4 Training Course Content

Demystifying Angular 2. SPAs for the Web of Tomorrow

Angular from the Beginning

Comprehensive Angular 2 Review of Day 3

Chapter 1 - Model Driven Forms

IEEE Wordpress Theme Documentation

Product Page PDF Magento Extension

Before proceeding with this tutorial, you should have a basic understanding of HTML, CSS, JavaScript, TypeScript, and Document Object Model (DOM).

Oceanica Theme Documentation

IN4MATX 133: User Interface Software

WEBSITE INSTRUCTIONS

DNCMagazine. ANGULAR. Cheat Sheet

Angular 4 Syllabus. Module 1: Introduction. Module 2: AngularJS to Angular 4. Module 3: Introduction to Typescript

Learn to Build Awesome Apps with Angular 2

Sample Copy. Not For Distribution.

WEBSITE INSTRUCTIONS. Table of Contents

Product Page PDF Magento 2 Extension

store.belvg US: UK:

Angular 2 Programming

SiteAssist Professional - Getting Started Guide

ANGULAR2 OVERVIEW. The Big Picture. Getting Started. Modules and Components. Declarative Template Syntax. Forms

Introduction to. Angular. Prof. Dr.-Ing. Thomas Wiedemann.

Understanding this structure is pretty straightforward, but nonetheless crucial to working with HTML, CSS, and JavaScript.

Where to buy Extension for Magento 2

FRONT END WEB. {< Course Details >}

Villagio WordPress Theme Documentation

Angular 2 and TypeScript Web Application Development

PIC 40A. Lecture 4b: New elements in HTML5. Copyright 2011 Jukka Virtanen UCLA 1 04/09/14

Angular 2 and TypeScript Web Application Development

Progressive web app. Juraj Kubala

CREATION SET-UP GUIDE

Decoupled Drupal with Angular

Beginning Drupai 7 TODD TOMLINSON. Apress

MEHR ZEIT FÜRS WESENTLICHE

Nagaraju Bende

PHPRad. PHPRad At a Glance. This tutorial will show you basic functionalities in PHPRad and

Cheiron Web Site: To Do and Done

Social Media Login M2 USER MANUAL MAGEDELIGHT.COM SUPPORT E:

Table of Contents. Introduction to Store Locator v How to Install and Deactivate How to Configure How to Use...

ANGULAR 2.X,4.X + TYPESRCIPT by Sindhu

"Charting the Course... Comprehensive Angular 6 Course Summary

ADDITIONAL GUIDES Customer SAP Enable Now Customization. Customer SAP SE or an SAP affiliate company. All rights reserved.

1. Beginning (Important)

Getting Started with MadCap Flare Part 2: Feature Concepts

28 JANUARY, Updating appearances. WordPress. Kristine Aa. Kristoffersen, based on slides by Tuva Solstad and Anne Tjørhom Frick

Tim Roes. Android- & inovex in Karlsruhe. GDG Karlsruhe Co-Organizer.

Single Page Applications using AngularJS

A Guide to Understand, Install and Use Pie Register WordPress Registration Plugin

Hands on Angular Framework

Using CSS for page layout

DOCUMENTATION OLAM WORDPRESS THEME

Oracle Forms and Oracle APEX The Odd Couple

INFORMATION ABOUT DOWNLOADS USING INTERNET BROWSERS

How to create level 1 and level 2 landing pages

Bootstrap your APEX authentication & authorisation. a presentation by

Stencil: The Time for Vanilla Web Components has Arrived

Stable currents. Nick Veenstra. Developing against the Pure API

REACH 3.0 Website redesign

Course Outline. ProTech Professional Technical Services, Inc. Comprehensive Angular 7 Course Summary. Description

Sign-up Forms Builder for Magento 2.x. User Guide

Dover Signature Theme (1190)

Who Am I? Neil Perlin - Hyper/Word Services.

Editing your SiteAssist Professional Template

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

Nilmini Theme Documentation

for Lukas Renggli ESUG 2009, Brest

Group bookings with Germania Fluggesellschaft mbh

Extending VMware vcloud Director User Interface Using Portal Extensibility Ticketing Example

React Loadable: Code Splitting with Server Side Rendering

Problems with the Imperative 1 Method

Here are the topics covered in this tutorial:

Estimating Reports: Easy Tips to Create a Great Report. Presented by Matt Carr

store.belvg US: UK:

Basics of Web Technologies

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

CASE STUDIES IN OIL AND GAS DIGITAL MARKETING

REDUX: FP FOR THE WEB

Bugis Theme Documentation

React & Redux in Hulu. (Morgan Cheng)

EFFECTIVE CONTENT MANAGEMENT

Supported 3rd Party Authentication Providers for Odyssys

Frontend UI Training. Whats App :

GIFT SHOP USER GUIDE. For gift, flower, toy and accessories stores. Version 1.0

CWCM Webmaster Training. Denis Bacquelaine, Technical Consultant I.R.I.S. Solutions & Experts S.A.

DOCUMENTATION OLAM WORDPRESS THEME

JavaScript II CSCI 311 SPRING 2017

Implementing a chat button on TECHNICAL PAPER

Steps to book your child in for Vacation Care

Transcription:

Routing into the Sunset with Angular Manfred Steyer SOFTWAREarchitekt.at About me Manfred Steyer SOFTWAREarchitekt.at Trainer & Consultant Focus: Angular Google Developer Expert (GDE) Manfred Steyer Page 2 1

Contents Basics Child Routes Aux Routes Guards Lazy Loading Angular Router Page 4 2

Routing in Angular Logo + Menu SPA Menu 2 Placeholder Footer Page 5 Routing in Angular /FlightApp/passenger Logo + Menu SPA Menu 2 Passenger- Component Footer Page 6 3

Configuration const APP_ROUTES: Routes = [ { path: 'home', component: HomeComponent }, { path: 'flight-search', component: FlightSearchComponent }, { path: '**', redirectto: 'home' } ] Page 7 Configuration // app.module.ts @NgModule({ imports: [ BrowserModule, HttpModule, FormsModule, RouterModule.forRoot(ROUTE_CONFIG) ], [ ] }) export class AppModule { For Root-Module } For Feature-Module: forchild Page 8 4

AppComponent <a routerlink="/home">home</a> <a routerlink="/flight-search">flight Search</a> <div> <router-outlet></router-outlet> </div> Page 9 Hierarchical Routing Page 15 5

Hierarchical Routing Logo + Menu SPA Menu 2 Placeholder 1 Footer Page 16 Hierarchical Routing /FlightDemo/flight-booking Logo + Menu SPA Menu 2 Footer FlightBookingComponent Page 17 6

Hierarchical Routing /FlightDemo/flight-booking Logo + Menu SPA Menu 2 Options Placeholder Footer FlightBookingComponent Page 18 Hierarchical Routing /FlightDemo/flight-booking/passenger Logo + Menu SPA Menu 2 Optionen Passenger Component Footer FlightBookingComponent Page 19 7

Configuration const APP_ROUTES: Routes = [ { path: '', component: HomeComponent }, { path: 'flight-booking', component: FlightBookingComponent, children: [ { path: 'flight-search', component: FlightSearchComponent }, [ ] ] } ]; Page 20 DEMO App Home Flight Booking Other Stuff Flight Search Flight Edit Passenger Search Page 21 8

Aux Routes Aux-Routes Logo + Menu SPA Menu 2 Placeholder Named Placeholder Footer Page 23 9

Aux-Routes /FlightApp/flights Logo + Menu SPA Menu 2 Flight- Component Named Placeholder Footer Page 24 Aux-Routes /FlightApp/flights(aux:info) Logo + Menu SPA Menu 2 Flight- Component Info-Component Footer Page 25 10

Aux-Routes /FlightApp/flights(aux:info/modal) Logo + Menu SPA Menu 2 Flight- Component Modal-Component Footer Page 26 Aux-Routes /FlightApp/flights(aux:info/modal)/edit/17 Logo + Menu SPA Menu 2 Flight-Edit- Component Modal-Component Footer Page 27 11

Use Cases Partly autonomous parts of an application Norton Commander Style (CSS-based) Popups and Modals DEMO Page 29 12

Guards Page 30 What are Guard? Services Can prevent the Activation or Deactivation of a Route Page 31 13

Guards CanActivate canactivate CanActivateChild canactivatechild CanLoad canload CanDeactivate<T> candeactivate Result: boolean Observable<boolean> Promise<boolean> Guards and the Router Configuration const APP_ROUTES: Routes = [ { path: '/flight-booking', component: FlightBookingComponent, canactivate: [AuthGuard], children: [ { path: 'flight-edit/:id', component: FlightEditComponent, candeactivate: [FlightEditGuard] }, [ ] ] ] Page 34 14

Provider for Guards // app.module.ts @NgModule({ providers: [ FlightEditGuard, AuthGuard ], [ ] }) export class AppModule { } Page 36 DEMO Page 37 15

Lazy Loading Module Structure AppModule SharedModule Root Module Feature Modules Shared Module Page 46 16

Lazy Loading AppModule SharedModule Root Module Feature Modules Shared Module Page 47 Root Module with Lazy Loading const APP_ROUTE_CONFIG: Routes = [ { path: 'home', component: HomeComponent }, { path: 'flights', loadchildren: './[ ]flight-booking.module#flightbookingmodule' } ]; Page 48 17

Routes for Feature Module const FLIGHT_ROUTES = [ { path: '', component: FlightBookingComponent, [ ] }, [ ] } Page 49 Routes for Feature Module const FLIGHT_ROUTES = [ { path: '/bookings', component: FlightBookingComponent, [ ] }, [ ] } Url: /flights/bookings Page 50 Triggers Lazy Loading 18

DEMO Preloading 19

Idea Modules that might be needed later are loaded after (!) the start of the application When the module is actually needed, it is available immediately Page 54 Activating Preloading const AppRoutesModule = RouterModule.forRoot( ROUTE_CONFIG, { preloadingstrategy: PreloadAllModules }); Page 55 20

DEMO Lazy Loading and Shared Modules Page 57 21

DEMO Page 58 Lazy Loading and Shared Modules AppModule AuthService SharedModule (lazy) FlightModule Page 59 22

Lazy Loading and Shared Modules AppModule AuthService SharedModule (lazy) FlightModule AuthService Page 60 Lazy Loading and Shared Modules AppModule AuthService SharedModule (lazy) FlightModule AuthService Page 61 23

Solution Global Providers like AuthService & Shell CoreModule AppModule SharedModule (lazy) FlightModule Only import CoreModule into AppModule! Page 62 Solution CoreModule AppModule AuthModule (lazy) FlightModule Page 65 24

Solution CoreModule AppModule (with Services) AuthModule (lazy) FlightModule (without Services) Page 66 Auth Module @NgModule({ [ ], providers: [] }) export class AuthModule { } Page 67 25

Auth Module @NgModule({ [ ], providers: [] }) export class AuthModule { static forroot(): ModuleWithProviders { return { ngmodule: AuthModule, providers: [AuthService, [ ]] } } } Page 68 DEMO Page 69 26

Conclusion Child Routes Guards Aux Routes Lazy Loading Downloads and Contact [mail] manfred.steyer@softwarearchitekt.at [blog] SOFTWAREarchitekt.at [twitter] 27