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
detectBrowser: function(window) { | |
var navigator = window && window.navigator; | |
// Returned result object. | |
var result = {}; | |
result.browser = null; | |
result.version = null; | |
// Fail early if it's not a browser | |
if (typeof window === 'undefined' || !window.navigator) { |
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 { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({name: 'groupBy'}) | |
export class GroupByPipe implements PipeTransform { | |
transform(collection: Array, property: string): Array { | |
// prevents the application from breaking if the array of objects doesn't exist yet | |
if(!collection) { | |
return null; | |
} |
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 { Directive, ElementRef, HostListener, Input } from '@angular/core'; | |
@Directive({ | |
// tslint:disable-next-line:directive-selector | |
selector: '[keyPrevent]' | |
}) | |
export class KeyPreventDirective { | |
constructor(private el: ElementRef) { } |
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 { Pipe } from '@angular/core'; | |
import { DecimalPipe } from '@angular/common'; | |
@Pipe({ | |
name: 'countConvert' | |
}) | |
export class ThousandPipe extends DecimalPipe { | |
transform(value: number): any { | |
if (499 > value) { | |
return super.transform((value || 0), '1.0-0'); |
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
0-mail.com | |
0815.ru | |
0clickemail.com | |
0wnd.net | |
0wnd.org | |
10minutemail.com | |
20minutemail.com | |
2prong.com | |
30minutemail.com | |
3d-painting.com |
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 { ErrorHandler, Injectable, Injector, NgZone } from '@angular/core'; | |
import { Router } from '@angular/router'; | |
@Injectable() | |
export class AppErrorHandler implements ErrorHandler { | |
constructor(private injector: Injector) { } | |
handleError(error: any): void { | |
const routerService = this.injector.get(Router); |
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 { EventEmitter, ElementRef, OnInit, Directive, Input, Output } from '@angular/core'; | |
import { Observable } from 'rxjs'; | |
import { NgModel } from '@angular/forms'; | |
@Directive({ selector: '[debounce]' }) | |
export class DebounceDirective implements OnInit { | |
@Input() delay: number = 700; | |
@Output() keyUpFunc: EventEmitter<any> = new EventEmitter(); | |
constructor(private elementRef: ElementRef, private model: NgModel) { |
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 { Directive, HostListener, HostBinding, EventEmitter, Output, Input } from '@angular/core'; | |
@Directive({ | |
selector: '[appDragAndDrop]' | |
}) | |
export class DragAndDropDirective { | |
@Input() private allowed_extensions: Array<string> = []; | |
@Output() private filesChangeEmiter: EventEmitter<File[]> = new EventEmitter(); | |
@Output() private filesInvalidEmiter: EventEmitter<File[]> = new EventEmitter(); | |
@HostBinding('style.background') private background = '#eee'; |
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 {Directive, ElementRef, HostListener, Input} from '@angular/core'; | |
@Directive({ | |
selector: '[onlyNumber]' | |
}) | |
export class OnlyNumberDirective { | |
@Input() | |
onlyNumber: boolean; |
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
ISODateString(d) { | |
function pad(n) { return n < 10 ? '0' + n : n } | |
return d.getUTCFullYear() + '-' | |
+ pad(d.getUTCMonth() + 1) + '-' | |
+ pad(d.getUTCDate()) + 'T' | |
+ pad(d.getUTCHours()) + ':' | |
+ pad(d.getUTCMinutes()) + ':' | |
+ pad(d.getUTCSeconds()) + 'Z'; | |
} |
NewerOlder