Skip to content

Instantly share code, notes, and snippets.

@jnizet
jnizet / confirm-modal-and-service.ts
Last active October 27, 2022 16:54
How to create a reusable service allowing to open a confirmation modal from anywhere with ng-bootstrap
import { Component, Injectable, Directive, TemplateRef } from '@angular/core';
import { NgbModal, NgbModalRef, NgbModalOptions } from '@ng-bootstrap/ng-bootstrap';
/**
* Options passed when opening a confirmation modal
*/
interface ConfirmOptions {
/**
* The title of the confirmation modal
*/
@kaplan81
kaplan81 / _testing.md
Last active August 8, 2022 19:27
Angular unit test helpers and samples

Testing

Helpers and examples for unit testing on Angular applications and libraries.

@JoniJnm
JoniJnm / date-fns-date-adapter.ts
Created January 4, 2019 11:44
date-fns angular material adapter
import {Injectable} from '@angular/core';
import {DateAdapter} from '@angular/material';
import {addDays, addMonths, addYears, format, getDate, getDaysInMonth, getMonth, getYear, parse, setDay, setMonth, toDate} from 'date-fns';
// CONFIG. Use environment or something for a dynamic locale and settings
import {es as locale} from 'date-fns/locale';
const WEEK_STARTS_ON = 1; // 0 sunday, 1 monday...
export const MAT_DATE_FNS_DATE_FORMATS = {
@maruware
maruware / Link.tsx
Last active June 14, 2023 02:51
custom Link component with material-ui + react-router-dom on TypeScript