flowchart TD
A[Deploy to production] --> B{Is it Friday?};
B -- Yes --> C[Do not deploy!];
B -- No --> D[Run deploy.sh to deploy!]
C ----> E[Enjoy your weekend!];
D ----> E[Enjoy your weekend!];
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { inject, InjectionToken } from '@angular/core'; | |
import { LumberjackLogDriverConfig, lumberjackLogDriverConfigToken } from '@ngworker/lumberjack'; | |
export const myLogDriverConfigToken = new InjectionToken<LumberjackLogDriverConfig>('__MY_LOG_DRIVER_CONFIG__', { | |
factory: () => inject(lumberjackLogDriverConfigToken), | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable, Inject } from '@angular/core'; | |
import { configToken } from './config.token'; | |
import { Config } from './config'; | |
@Injectable({ | |
providedIn: 'any', // 👈 Tree-shakable, only bundled if used | |
}) | |
export class ConfigService { | |
constructor(@Inject(configToken) private config: Config) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Location } from '@angular/common'; | |
import { Component, Injectable, NgModule, NgZone } from '@angular/core'; | |
import { TestBed } from '@angular/core/testing'; | |
import { Router, RouterModule, Routes } from '@angular/router'; | |
import { RouterTestingModule } from '@angular/router/testing'; | |
import { of } from 'rxjs'; | |
import { AuthGuard } from './auth.guard'; | |
import { AuthService } from './auth.service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
ActivatedRouteSnapshot, | |
Params, | |
Route, | |
Router, | |
RouterStateSnapshot, | |
UrlSegment, | |
} from '@angular/router'; | |
import { AuthGuard } from './auth.guard'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DOCUMENT } from '@angular/common'; | |
import { Inject, Injectable, Renderer2 } from '@angular/core'; | |
import { Observable, ReplaySubject } from 'rxjs'; | |
import { switchMapTo, tap } from 'rxjs/operators'; | |
@Injectable({ | |
providedIn: 'root', | |
}) | |
export class ScriptService { | |
private scriptLoaded = new Map<string, Observable<void>>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div *ngIf="hero"> | |
<h2> | |
{{hero.name | uppercase}} Details | |
</h2> | |
<div> | |
<span>id:</span> | |
{{hero.id}} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div *ngIf="hero"> | |
<h2> | |
{{hero.name | uppercase}} Details | |
</h2> | |
<div> | |
<span>id:</span> | |
{{hero.id}} | |
</div> |