This file contains hidden or 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
| { | |
| extends: ["eslint:recommended"], | |
| rules: { | |
| "no-unused-vars": "off", | |
| } | |
| }, | |
| // VS | |
| { | |
| ...eslint.configs.recommended, | |
| rules: { |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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, | |
| }, | |
| }; |
This file contains hidden or 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 interface ToastConfig { | |
| position?: { | |
| top: number; | |
| right: number; | |
| }; | |
| animation?: { | |
| fadeOut: number; | |
| fadeIn: number; | |
| }; | |
| } |
This file contains hidden or 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
| onFadeFinished(event: AnimationEvent) { | |
| const { toState } = event; | |
| const isFadeOut = (toState as ToastAnimationState) === 'closing'; | |
| const itFinished = this.animationState === 'closing'; | |
| if (isFadeOut && itFinished) { | |
| this.close(); | |
| } | |
| } |
NewerOlder