Skip to content

Instantly share code, notes, and snippets.

View LayZeeDK's full-sized avatar
🇩🇰
Denmark

Lars Gyrup Brink Nielsen LayZeeDK

🇩🇰
Denmark
View GitHub Profile
@LayZeeDK
LayZeeDK / dashboard.component.html
Last active February 8, 2023 23:16
Dashboard: Shallow and integrated routing component test suites.
<h3>Top Heroes</h3>
<div class="grid grid-pad">
<a *ngFor="let hero of heroes" class="col-1-4"
routerLink="/detail/{{hero.id}}">
<div class="module hero">
<h4>{{hero.name}}</h4>
</div>
</a>
</div>
@LayZeeDK
LayZeeDK / generate-project.js
Last active April 28, 2022 08:04
Angular CLI workspace tool: Generate project.
const childProcess = require('child_process');
const fs = require('fs');
const yargs = require('yargs');
function addScopeToLibraryProjectName({ name, scope }) {
runCommand('npx json -I -f angular.json '
+ `-e "this.projects['${scope}-${name}'] = this.projects['${name}']"`);
runCommand(`npx json -I -f angular.json -e "delete this.projects['${name}']"`);
}
@LayZeeDK
LayZeeDK / angular-compatibility.md
Created February 19, 2020 21:22
Angular compatibility table - Markdown version
Angular CLI version Angular version Node.js version TypeScript version
- 2.x 6.0.x or later minor version 2.0.x
1.0.6 4.x 6.9.x or later minor version 2.2.x
1.1.3 4.x 6.9.x or later minor version 2.3.x
1.2.7 4.x 6.9.x or later minor version 2.3.x
1.3.2 4.2.x or later minor version 6.9.x or later minor version 2.4.x
1.4.10 4.2.x or later minor version 6.9.x/8.9.x or later minor version 2.4.x
(1.5.6) 5.0.x 6.9.x/8.9.x or later minor version 2.4.x
1.5.6 5.1.x
@LayZeeDK
LayZeeDK / angular-view-engine-to-ivy-transition.csv
Last active July 23, 2021 07:27
The Angular View Engine-to-Ivy transition plan.
Angular version Application engine Library engine Status
Version 9 View Engine View Engine Supported, but not recommended
Version 9 View Engine Ivy Not supported
Version 9 Ivy View Engine Recommended
Version 9 Ivy Ivy Supported, but not recommended
Version 10 View Engine View Engine Supported, but not recommended
Version 10 View Engine Ivy Not supported
Version 10 Ivy View Engine Supported, but not recommended
Version 10 Ivy Ivy Recommended
Version 11 View Engine View Engine Not supported
@LayZeeDK
LayZeeDK / angular-ivy-detection.ts
Last active February 17, 2020 05:09
Angular Ivy detection logic.
import {
Type,
ɵNG_COMP_DEF,
ɵNG_DIR_DEF,
ɵNG_MOD_DEF,
ɵNG_PIPE_DEF,
} from '@angular/core';
function isIvy(): boolean {
const ng: any = ((self || global || window) as any).ng;
@LayZeeDK
LayZeeDK / index.html
Last active November 24, 2019 21:50
From Misko Hevery's keynote at ng-conf 2019
<todo-app component="./todo-app-component">
<item component="./todo-component">
<input type=”checkbox” checked click>
<span class=”done”>Research</span>
</item>
<item component="./todo-component">
<input type=”checkbox” click>
<span>Development</span>
</item>
@LayZeeDK
LayZeeDK / configuration.ts
Last active January 14, 2022 19:11
Providing a configuration as a static dependency.
import { InjectionToken } from '@angular/core';
// We create an interface for the configuration JSON object
export interface Configuration {
readonly apiUrl: string;
readonly timezone: string;
readonly websocketUrl: string;
}
// We use a dependency injection token to access the configuration
@LayZeeDK
LayZeeDK / cart.component.html
Created September 22, 2019 21:18
Cart: Initial mixed component.
<h3>Cart</h3>
<p>
<a routerLink="/shipping">Shipping Prices</a>
</p>
<div class="cart-item" *ngFor="let item of items">
<span>{{ item.name }} </span>
<span>{{ item.price | currency }}</span>
</div>
@LayZeeDK
LayZeeDK / checkout.presenter.ts
Created September 22, 2019 21:08
Cart: Checkout presenter.
import { Injectable } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { Customer } from '../../customer';
@Injectable()
export class CheckoutPresenter {
form = this.formBuilder.group({
name: '',
address: '',
@LayZeeDK
LayZeeDK / checkout.component.html
Created September 22, 2019 20:59
Cart: Checkout component.
<form [formGroup]="checkoutForm" (ngSubmit)="onSubmit()">
<div>
<label for="name">
Name
</label>
<input id="name" type="text" formControlName="name">
</div>
<div>
<label for="address">