Slide 1

Slide 1 text

@ManfredSteyer Modern Angular: Renovation for Your Applications ManfredSteyer

Slide 2

Slide 2 text

@ManfredSteyer Agenda #1 esbuild #2a Standalone Components #2b Standalone APIs: Router & Http #3 Signals #4 SSR & Hydration #5 Control Flow & @defer

Slide 3

Slide 3 text

@ManfredSteyer About me… Manfred Steyer, ANGULARarchitects.io (Remote) Angular Workshops and Consulting Google Developer Expert for Angular Blog, Books, Articles, and Talks about Angular Manfred Steyer

Slide 4

Slide 4 text

@ManfredSteyer #1: esbuild

Slide 5

Slide 5 text

@ManfredSteyer New Generation of Bundlers webpack vite

Slide 6

Slide 6 text

@ManfredSteyer ng update

Slide 7

Slide 7 text

@ManfredSteyer #2: Standalone Components & APIs

Slide 8

Slide 8 text

@ManfredSteyer NgModules + EcmaScript Modules import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent } from './app.component'; […] @NgModule({ imports: [BrowserModule, OtherModule], declarations: [AppComponent, OtherComponent, OtherDirective], providers: [], bootstrap: [AppComponent], }) export class AppModule {} TypeScript Modules Angular Modules

Slide 9

Slide 9 text

@ManfredSteyer Standalone Components @Component({ standalone: true, imports: [ […], FlightCardComponent, CityPipe, CityValidator, ], selector: 'flight-search', templateUrl: '…' }) export class FlightSearchComponent { […] }

Slide 10

Slide 10 text

@ManfredSteyer Global Providers bootstrapApplication(AppComponent, { providers: [ MyGlobalService, importProvidersFrom(LegacyModule), provideRouter(APP_ROUTES), ] });

Slide 11

Slide 11 text

@ManfredSteyer Standalone Component → NgModules @Component({ standalone: true, selector: 'app-root', imports: [ […] TicketsModule, ], templateUrl: '…' }) export class AppComponent { }

Slide 12

Slide 12 text

@ManfredSteyer Standalone Component → NgModules @Component({ standalone: true, selector: 'app-root', imports: [ […] TicketsModule, ], templateUrl: '…' }) export class AppComponent { }

Slide 13

Slide 13 text

@ManfredSteyer NgModule → Standalone Blocks @NgModule({ imports: [ FlightCardComponent, ], declarations: [ MyTicketsComponent ], }) export class TicketsModule { }

Slide 14

Slide 14 text

@ManfredSteyer NgModule → Standalone Blocks @NgModule({ imports: [ FlightCardComponent, ], declarations: [ MyTicketsComponent ], }) export class TicketsModule { }

Slide 15

Slide 15 text

@ManfredSteyer Automatic Migration ng g @angular/core:standalone

Slide 16

Slide 16 text

@ManfredSteyer DEMO

Slide 17

Slide 17 text

@ManfredSteyer More Migrations ng g @angular/core:route-lazy-loading ng g @angular/core:inject-migration

Slide 18

Slide 18 text

@ManfredSteyer #3: Signals

Slide 19

Slide 19 text

@ManfredSteyer Signals: Simple Reactivity Signal as Producer 4711 Consumer read set notify 4712

Slide 20

Slide 20 text

@ManfredSteyer Component With Signals flights = signal([]); const flights = await this.flightService.findAsPromise(from, to); this.flights.set(flights);

Slide 21

Slide 21 text

@ManfredSteyer DEMO

Slide 22

Slide 22 text

@ManfredSteyer Stores Streamline Reactive Flow Component Store "Intention" Signal sync/ async computed() computed()

Slide 23

Slide 23 text

@ManfredSteyer NGRX Signal Store export const FlightBookingStore = signalStore( { providedIn: 'root' }, […] );

Slide 24

Slide 24 text

@ManfredSteyer NGRX Signal Store export const FlightBookingStore = signalStore( { providedIn: 'root' }, withState({ from: 'Paris', to: 'London', […] }), […] );

Slide 25

Slide 25 text

@ManfredSteyer NGRX Signal Store export const FlightBookingStore = signalStore( { providedIn: 'root' }, withState({ from: 'Paris', to: 'London', […] }), withComputed(([…]) => ({ […] })), withMethods(([…]) => ({ })), withHooks({ […] }) );

Slide 26

Slide 26 text

@ManfredSteyer DEMO

Slide 27

Slide 27 text

@ManfredSteyer #4: SSR & Hydration

Slide 28

Slide 28 text

@ManfredSteyer When to use SSR? B2C Initial Page Loads Conversion Rate! SEO Social Preview

Slide 29

Slide 29 text

@ManfredSteyer Adding SSR ng new myProject --ssr or ng add @angular/ssr

Slide 30

Slide 30 text

@ManfredSteyer DEMO

Slide 31

Slide 31 text

@ManfredSteyer #5: New Control Flow & @defer

Slide 32

Slide 32 text

@ManfredSteyer @if @if(auth.userName) {

Welcome {{auth.userName}}!

} @else {

Welcome!

Please log in!

}

Slide 33

Slide 33 text

@ManfredSteyer @if @if(auth.userName) {

Welcome {{auth.userName}}!

} @else if(auth.trial) {

Welcome to this trial version!

Please sign up to get the full version!

} @else {

Welcome!

Please log in!

}

Slide 34

Slide 34 text

@ManfredSteyer @for @for(f of flights; track f.id) { }

Slide 35

Slide 35 text

@ManfredSteyer @for @for(f of flights; track f.id) { } @empty {

No flights found!

}

Slide 36

Slide 36 text

@ManfredSteyer Automatic Migration ng g @angular/core:control-flow

Slide 37

Slide 37 text

@ManfredSteyer DEMO

Slide 38

Slide 38 text

@ManfredSteyer @defer @defer (on viewport) { } @placeholder {
Placeholder
}

Slide 39

Slide 39 text

@ManfredSteyer DEMO

Slide 40

Slide 40 text

@ManfredSteyer Free eBook (2nd Edition) angularArchitects.io/modern

Slide 41

Slide 41 text

@ManfredSteyer Summary esbuild: Build Performance Standalone: Simplicity APIs for Router & Http: Simplicity Signals: Reactivity & Performance SSR: Simplicity & Initial Page Load Control Flow & @defer: Simplicity & Performance

Slide 42

Slide 42 text

@ManfredSteyer Contact and Downloads [web] ANGULARarchitects.io [twitter] ManfredSteyer d Slides & Examples Remote Company Workshops and Consulting http://angulararchitects.io