Skip to content

Instantly share code, notes, and snippets.

View Banttu's full-sized avatar

Andreas Siivola Banttu

View GitHub Profile
@Banttu
Banttu / mq-if.directive.ts
Last active February 22, 2023 09:44 — forked from davidmarquis/angular2-if-media-query-directive.ts
Angular: Conditional output from media query using a structural directive
import { Input, Directive, TemplateRef, ViewContainerRef, OnDestroy } from '@angular/core';
/**
* How to use this directive?
*
* ```
* <div *mqIf="'(min-width: 500px)'">
* Div element will exist only when media query matches, and created/destroyed when the viewport size changes.
* </div>
* ```
*/
@Banttu
Banttu / flatpickr.component.html
Created July 18, 2017 18:19
Flatpickr component for use with Angular
<button (click)="toggle()">Date</button>
<div [hidden]="!visible">
<div #flatpickr></div>
</div>