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
export class AppPreloadingStrategy implements PreloadingStrategy { | |
preload(route: Route, load: Function): Observable<any> { | |
const loadRoute = (delay) => delay | |
? timer(150).pipe(flatMap(_ => load())) | |
: load(); | |
return route.data && route.data.preload | |
? loadRoute(route.data.delay) | |
: of(null); | |
} | |
} |
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 { TestBed, async, ComponentFixture } from "@angular/core/testing"; | |
import { Component } from "@angular/core"; | |
import { By } from "@angular/platform-browser"; | |
@Component({ | |
selector: "dh-app-div", | |
template: ` | |
<span *ngFor="let item of foo | keyvalue"> | |
{{ item }} |
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
@NgModule({ | |
providers: [ | |
{ | |
provide: externalUrlProvider, | |
useValue: (route: ActivatedRouteSnapshot) => { | |
const externalUrl = route.paramMap.get('externalUrl'); | |
window.open(externalUrl, '_self'); | |
}, | |
}, | |
], |
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
const trace = x => (console.log(x), x) | |
const two = trace(2); //? 2 |
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
export class ToastData { | |
type: ToastType; | |
text?: string; | |
template?: TemplateRef<any>; | |
templateContext?: {}; | |
} |
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
selectStep(stepIndex: number) { | |
const step = this._steps.toArray()[stepIndex]; | |
if (step) { | |
step.select(); | |
} | |
} |
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
public static forRoot(config = defaultToastConfig): ModuleWithProviders { | |
return { | |
ngModule: ToastModule, | |
providers: [ | |
{ | |
provide: TOAST_CONFIG_TOKEN, | |
useValue: { ...defaultToastConfig, ...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
<ng-container *ngIf="data.text; else templateRef"> | |
{{ data.message }} | |
</ng-container> | |
<ng-template #templateRef> | |
<ng-container *ngTemplateOutlet="data.template; context: data.templateContext"> | |
</ng-container> | |
</ng-template> |
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
export const defaultToastConfig: ToastConfig = { | |
position: { | |
top: 20, | |
right: 20, | |
}, | |
animation: { | |
fadeOut: 2500, | |
fadeIn: 300, | |
}, | |
}; |
NewerOlder