Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Lightweight Architectures With Angular's Latest...

Lightweight Architectures With Angular's Latest Innovations

Manfred Steyer

March 24, 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 @Component({ standalone: true, imports: [ […], FlightCardComponent, CityPipe, CityValidator,

    ], selector: 'flight-search', templateUrl: '…' }) export class FlightSearchComponent { […] }
  4. @ManfredSteyer It looks like you want to use NgIfDirective and

    MyComponent. Shall I import it for you?
  5. @ManfredSteyer Small and Medium Apps: Folder per Feature // index.ts

    == Public API export * from './flight-booking.routes';
  6. @ManfredSteyer Restricting Access b/w Domains, etc. on a folder basis

    Credits to: Rainer Hahnekamp, AngularArchitects Follow me for more information on this during the next weeks! @softarc/eslint-plugin-sheriff
  7. @ManfredSteyer → @Component({ standalone: true, selector: 'app-root', imports: [ […]

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

    TicketsModule, ], templateUrl: '…' }) export class AppComponent { }
  9. @ManfredSteyer export const APP_ROUTES: Routes = [ […] { path:

    'flight-booking', canActivate: [() => inject(AuthService).isAuthenticated()], component: FlightBookingComponent }, ]
  10. @ManfredSteyer export const APP_ROUTES: Routes = [ […] { path:

    'flight-booking', canActivate: [() => inject(AuthService).isAuthenticated()], component: FlightBookingComponent }, ]
  11. @ManfredSteyer export const APP_ROUTES: Routes = [ […] { path:

    'flight-booking', canActivate: [() => inject(AuthService).isAuthenticated()], resolve: { flights: () => inject(FlightService).findAll() }, component: FlightBookingComponent }, ]