- Define
Pagination
class - Define
PaginatedList<T>
generic class - Utility functions for parsing http response
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
- 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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blobToJson(blob: Blob): Observable<any> { | |
let loadend: Observable<any>; | |
if (blob.type === 'application/json') { | |
const reader = new FileReader(); | |
loadend = fromEvent(reader, 'loadend').pipe( | |
map((read: any) => { | |
this.logger.debug('blobToJson:loadend *', JSON.parse(read.target.result)); | |
return JSON.parse(read.target.result); | |
}) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This module aims to provides stubs Google Maps (Javascript API). | |
* It is not comprehensive, but a working solution that allows unit testing, without the async pain. | |
* @example | |
* import * as google from './google-maps.spec'; | |
* (<any>window).google = google; | |
*/ | |
export const google = { | |
maps: { | |
ControlPosition: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is a node script to merge cobertura reports in XML format. | |
* It requires `xml2js` : `npm i -D xml2js` | |
* | |
* Execute with: | |
* ``` | |
* node merge-cobertura.js coverage/file1.xml coverage/file2.xml to=coverage-final.xml | |
* ``` | |
* @see https://github.com/Leonidas-from-XIV/node-xml2js | |
* @author Jérémy Legros |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @see http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php | |
*/ | |
class Test { | |
constructor() { | |
this.FN = []; | |
this.FNDA = []; | |
this.DA = []; | |
this.BRDA = []; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Mocked location object. Includes the original to rollback to the native one */ | |
export interface MockedLocation { | |
/** The original location definition */ | |
original: Location; | |
/** Restore the original location object */ | |
clear(): void; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Usage: | |
@Action(nameOf<ActionFn>('myAction'), { namespace: 'my-module'}) | |
loadGraph!: ActionType<'myAction'>; | |
*/ | |
function _createActions() { | |
return { |
OlderNewer