Skip to content

Instantly share code, notes, and snippets.

@merlosy
merlosy / README.md
Last active May 22, 2021 22:13
Angular 4+ Material input field

Angular Material - File Upload field

  • Compatible with model driven validation (Reactive forms)
  • tested on Angular Material Beta 12
  • Implemented with Angular 4.4.x

For easier maintaining, I moved all sources on Plunker: SEE LIVE DEMO ON PLUNKER

Note: Getting the model value, returns an FileInput object (type FileInput)

@merlosy
merlosy / README.md
Last active November 11, 2022 15:41
Paginated list in Typescript (from Content-Range header)

Pagination abstraction layer

  • Define Pagination class
  • Define PaginatedList<T> generic class
  • Utility functions for parsing http response
@merlosy
merlosy / logger.ts
Created April 4, 2017 13:50
safe logger in Typescript
import { environment } from './../../../environments/environment';
export class Logger {
public static isActive = () => !environment.production;
private static noop = function(){};
public static info = Logger.isActive()? ( console && console.info ) && console.info.bind(console) : Logger.noop;
public static log = Logger.isActive()? ( console && console.log ) && console.log.bind(console) : Logger.noop;