Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Netanel Basal NetanelBasal

🎯
Focusing
Block or report user

Report or block NetanelBasal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View akita-active-all.ts
query.selectActiveId().pipe(
switchMap(activeId => {
if (active == null) {
return fetchAll().pipe(tap(updateStore))
} else {
return forkJoin(
fetchAll(),
fetchEntity(activeId)
).pipe(tap(updateActiveAndAll))
}
View cap-6.ts
export class AppComponent {
group = new FormGroup({
email: new FormControl(),
password: new FormControl(),
captcha: new FormControl(),
})
}
View cap-4.ts
@Component({
providers: [
{
provide: NG_VALIDATORS,
useExisting: CaptchaComponent,
multi: true
}
]
})
export class CaptchaComponent implements OnInit, ControlValueAccessor {
View cap-3.ts
@Component({...})
export class CaptchaComponent implements OnInit, ControlValueAccessor {
@ViewChild('canvas', { static: true }) canvas: ElementRef<HTMLCanvasElement>;
answer: number;
ngOnInit() { this.createCaptcha(); }
...
createCaptcha() {
View cap-2.html
<div>
<canvas #canvas width="130" height="50"></canvas>
<input type="number" (input)="change(input.value)" #input>
</div>
View cap-1.ts
@Component({
selector: 'app-captcha',
templateUrl: './captcha.component.html',
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: CaptchaComponent,
multi: true
},
]
View is-7.ts
@Component({
selector: 'app-tweets',
template: `
<infinite-scroll (scrolled)="onScroll()" style="height: 400px; overflow-y: auto">
...
</infinite-scroll>
`
})
export class TweetsComponent implements OnInit {
...
View is-5.ts
@Component({
selector: 'app-tweets',
template: `
<infinite-scroll (scrolled)="onScroll()">
<app-tweet *ngFor="let tweet of tweets$ | async" [tweet]="tweet"></app-tweet>
<div *ngIf="isLoading$ | async">
Fetching tweets...
</div>
</infinite-scroll>
View is-4.ts
@Component({
selector: 'infinite-scroll',
template: `<ng-content></ng-content><div #anchor></div>`
})
export class InfiniteScrollComponent implements OnInit, OnDestroy {
...
ngOnInit() {
const options = {
root: this.isHostScrollable() ? this.host.nativeElement : null,
View is-3.ts
ngOnDestroy() {
this.observer.disconnect();
}
You can’t perform that action at this time.