Skip to content

Instantly share code, notes, and snippets.

View kaplan81's full-sized avatar
💭
Learning GraphQL

Andres Gesteira kaplan81

💭
Learning GraphQL
  • Berlin. Germany.
View GitHub Profile
import { Constructor } from '../../models/constructor.model';
import { isWindow } from '../../utils/window/window.util';
/**
* // constructor.model.ts
* export type Constructor<T = unknown> = new (...args: any[]) => T;
*
* // window.util.ts
* export const isWindow = (element: typeof globalThis | Window | HTMLElement | null): boolean => {
* return element !== null
import { Constructor } from '../../models/constructor.model';
import { isWindow } from '../../utils/window/window.util';
/**
* // constructor.model.ts
* export type Constructor<T = unknown> = new (...args: any[]) => T;
*
* // window.util.ts
* export const isWindow = (element: typeof globalThis | Window | HTMLElement | null): boolean => {
* return element !== null
import { NavRoute } from '@akelius-bsc/ng-kit';
import { Location } from '@angular/common';
import { Injectable } from '@angular/core';
import { NavigationExtras, Router } from '@angular/router';
import * as fromRootModels from '@asset-app/models';
import * as routerActions from '@asset-app/store/actions/router.action';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { map, tap } from 'rxjs/operators';
@Injectable()
import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core';
import { interval, Observable, Subscription } from 'rxjs';
import { takeUntil, tap } from 'rxjs/operators';
import { ondestroy } from '../_app/decorators/ondestroy.decorator';
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './decorator.component.html',
})
export class DecoratorComponent implements OnInit, OnDestroy {
import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core';
import { interval, Observable, Subject, Subscription } from 'rxjs';
import { takeUntil, tap } from 'rxjs/operators';
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './boilerplate.component.html',
})
export class BoilerplateComponent implements OnInit, OnDestroy {
destroyed$ = new Subject<void>();
import { ɵComponentDef, ɵComponentType } from '@angular/core';
import { Subject } from 'rxjs';
// TODO: move models to their own file.
// We need this interface override the readonly keyword
// on the properties that we want to re-assign.
export interface ComponentDef<T> extends ɵComponentDef<T> {
factory: FactoryFn<T>;
onDestroy: (() => void) | null;
import { Component, OnDestroy } from '@angular/core';
import { Subject } from 'rxjs';
// WARNING: THIS DECORATOR DOES NOT WORK IN ANGULAR 9 WITH IVY.
/**
* Method decorator to automatically unsubscribe in component classes.
*
* @example
* ```ts
# This sets up Version Control System Info (vcs_info).
autoload -Uz vcs_info
# This hook function is executed before each prompt.
precmd() { vcs_info }
# This is needed to add this to our prompt: ${vcs_info_msg_0_}
setopt prompt_subst
# %F stands for foreground color and you reset it with %f.
# %B stands for bold and you reset it with %b.
# Color is set between brackets ({}) and it follows this reference>:
import { ComponentSuite, ComponentSuiteElements } from '@my-test-kit';
import { PortalModule, TemplatePortal } from '@angular/cdk/portal';
import {
AfterContentInit,
Component,
TemplateRef,
ViewChild,
ViewContainerRef
} from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DebugElement } from '@angular/core';
import { ComponentFixture } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
export interface ComponentSuiteElements<H, N = any> {
host: ComponentTestingElement<H>;
nested?: ComponentTestingElement<N>;
}
export interface ComponentTestingElement<T> {