Skip to content

Instantly share code, notes, and snippets.

View alexzuza's full-sized avatar
🎯
Focusing

Alexey Zuev alexzuza

🎯
Focusing
View GitHub Profile
<div *ngIf="showHelp"
class="context-help-dialog"
(document:click)="documentClicked($event)"
(window:keydown.Escape)="escapedClicked()"
>
{{ content }}
</div>
platformBrowser()
.bootstrapModule(AppModule, { ngZoneEventCoalescing: true });
import { Component, OnInit, Input, ElementRef, HostListener, ViewChild } from '@angular/core';
@Component({
selector: '[context-help]',
templateUrl: './context-help.component.html',
styleUrls: ['./context-help.component.css'],
})
export class ContextHelpComponent {
@Input('context-help') content: string;
<ng-content></ng-content>
<div class="context-help-container" #container>
<i (click)="showHelp = true;"></i>
<div *ngIf="showHelp" class="context-help-dialog">
{{ content }}
</div>
</div>
<h3 context-help="Some description 1">Some title 1</h3>
@alexzuza
alexzuza / products.html
Created August 28, 2019 17:52
Products html
<h2 class="title">Products</h2>
<div class="search-bar">
<input (input)="searchStream$.next($event.target.value)">
</div>
<div class="results">
<h3>Built-in solution</h3>
<div *ngIf="obs$ | async as obs">
<ng-template [ngIf]="obs.type === 'finish'">
@alexzuza
alexzuza / with-loading.pipe.ts
Created August 28, 2019 17:50
With loading pipe long living stream
import { Pipe, PipeTransform } from '@angular/core';
import { isObservable, of } from 'rxjs';
import { map, startWith, catchError } from 'rxjs/operators';
@Pipe({
name: 'withLoading',
})
export class WithLoadingPipe implements PipeTransform {
transform(val) {
return isObservable(val)
@alexzuza
alexzuza / with-loading.pipe.ts
Created August 28, 2019 16:52
With loading pipe
import { Pipe, PipeTransform } from '@angular/core';
import { isObservable, of } from 'rxjs';
import { map, startWith, catchError } from 'rxjs/operators';
@Pipe({
name: 'withLoading',
})
export class WithLoadingPipe implements PipeTransform {
transform(val) {
return isObservable(val)
static ngTypeCtor<T>(init: Partial<Pick<NgForOf<T>, 'ngForOf'|'ngForTrackBy'|'ngForTemplate'>>): NgForOf<T>;
function _tcb1(ctx: i0.AppComponent) {
if (true) {
var _t1 = document.createElement("input");
_t1.s; // Property 's' does not exist on type 'HTMLInputElement'.
}
}