View tooltip-angular1.ts
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
@Component({ | |
selector: 'app-root', | |
template: ` | |
<div class="container"> | |
<p tooltip="Tooltip from text">Tooltip from text</p> | |
<p [tooltip]="template">Tooltip from TemplateRef</p> | |
<ng-template #template> | |
<span>Tooltip from TemplateRef</span> |
View relative-guard-3.ts
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 } from '@angular/core'; | |
import { ActivatedRouteSnapshot, createUrlTreeFromSnapshot } from '@angular/router'; | |
@Injectable({ providedIn: 'root' }) | |
export class MyGuard implements CanActivate { | |
canActivate(route: ActivatedRouteSnapshot) { | |
if(checkData(route)) { | |
return createUrlTreeFromSnapshot(route, ['../sibling']); | |
} |
View relative-guard-1.ts
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
@Injectable({ providedIn: 'root' }) | |
export class MyGuard implements CanActivate { | |
constructor(private router: Router, private route: ActivatedRoute) { } | |
canActivate(route: ActivatedRouteSnapshot) { | |
if(checkData(route)) { | |
this.router.navigate(['../sibling'], { relativeTo: this.route }); | |
return false; | |
} | |
View ll-20.ts
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 { ComponentFactoryResolver, ComponentRef, Directive, EventEmitter, Input, Type, ViewContainerRef } from '@angular/core'; | |
import { Subscription } from 'rxjs'; | |
@Directive({ | |
selector: '[lazyComp]' | |
}) | |
export class LazyCompDirective { | |
private _inputs; | |
private _outputs; | |
private subscription = new Subscription(); |
View can-match-1.ts
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
@Injectable({ providedIn: 'root' }) | |
class CanMatchNewTodos implements CanMatch { | |
constructor(private ff: FeatureFlagsService) { } | |
canMatch() { | |
return this.ff.hasPermission('todos-v2'); | |
} | |
} |
View copy-55.directive.ts
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 { fakeAsync, tick } from '@angular/core/testing'; | |
import { HotToastService } from '@ngneat/hot-toast'; | |
import { createDirectiveFactory } from '@ngneat/spectator'; | |
import { CopyDirective } from './copy.directive'; | |
describe('CopyDirective', () => { | |
const createDirective = createDirectiveFactory({ | |
directive: CopyDirective, | |
mocks: [HotToastService] | |
}); |
View copy-44.directive.ts
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 { Directive, ElementRef, Input, NgZone } from '@angular/core'; | |
import { HotToastService } from '@ngneat/hot-toast'; | |
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; | |
import { fromEvent, switchMap } from 'rxjs'; | |
@UntilDestroy() | |
@Directive({ | |
selector: '[copy]' | |
}) | |
export class CopyDirective { |
View copy-33.directive.ts
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 { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; | |
@UntilDestroy() | |
@Directive({ | |
selector: '[copy]' | |
}) | |
export class CopyDirective { | |
@Input() copy: string; | |
constructor( |
View copy-22.directive.ts
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 { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; | |
@UntilDestroy() | |
@Directive({ | |
selector: '[copy]' | |
}) | |
export class CopyDirective { | |
@Input() copy: string; | |
constructor(private host: ElementRef<HTMLElement>) {} |
View copy-11.html
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
<button copy="Clicking this button copies this text to the clipboard"> | |
Copy | |
</button> | |
<button [copy]="fooText"> | |
Copy | |
</button> |
NewerOlder