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

October 17, 2023
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

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

    ], selector: 'flight-search', templateUrl: '…' }) export class FlightSearchComponent { […] }
  3. @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>
  4. @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> }
  5. @ManfredSteyer @for @for(f of flights; track f.id) { <flight-card [item]="f"

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