Skip to content

Instantly share code, notes, and snippets.

View AlejandroPerezMartin's full-sized avatar
🇮🇨

Alejandro Pérez Martín AlejandroPerezMartin

🇮🇨
View GitHub Profile
const isRequired = () => { throw new Error('param is required'); };
function filterEvil(array, evil = isRequired()) {
return array.filter(item => item !== evil);
}
@AlejandroPerezMartin
AlejandroPerezMartin / button-focus-remover.ts
Last active April 11, 2023 15:18
Angular 9+ Directive to remove focus after clicking the specified selector/s
import { Directive, HostListener, ElementRef } from '@angular/core';
/**
* This directive removes focus from the selectors after clicking on them
*/
@Directive({
selector: 'button, a' // your selectors here!
})
export class FocusRemover {
constructor(private elRef: ElementRef) {}
@demisx
demisx / angularjs-providers-explained.md
Last active May 17, 2024 03:38
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant