Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Modern Angular: Renovation for Your Applications

Modern Angular: Renovation for Your Applications

Manfred Steyer

July 03, 2024
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. @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
  2. @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
  3. @ManfredSteyer @Component({ standalone: true, imports: [ […], FlightCardComponent, CityPipe, CityValidator,

    ], selector: 'flight-search', templateUrl: '…' }) export class FlightSearchComponent { […] }
  4. @ManfredSteyer → @Component({ standalone: true, selector: 'app-root', imports: [ […]

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

    TicketsModule, ], templateUrl: '…' }) export class AppComponent { }
  6. @ManfredSteyer flights = signal<Flight[]>([]); const flights = await this.flightService.findAsPromise(from, to);

    this.flights.set(flights); <div *ngFor="let f of flights()"> <flight-card [item]="f" /> </div>
  7. @ManfredSteyer Stores Streamline Reactive Flow Component Store "Intention" Signal sync/

    async computed() computed() Currently: Main Use Case for Signas and/or RxJS
  8. @ManfredSteyer @if @if(auth.userName) { <h2>Welcome {{auth.userName}}!</h2> } @else if(auth.trial) {

    <h2>Welcome to this trial version!</h2> <p>Please sign up to get the full version!</p> } @else { <h2>Welcome!</h2> <p>Please log in!</p> }
  9. @ManfredSteyer @for @for(f of flights; track f.id) { <flight-card [item]="f"

    [(selected)]="basket[f.id]" /> } @empty { <p>No flights found!</p> }