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 { Injectable } from '@angular/core'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class UtilsService { | |
/** | |
* Turn somthing like this: data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCA..." | |
* into a BLOB |
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 { Injectable } from '@angular/core'; | |
import { EventEmitter } from '@angular/core'; | |
@Injectable({ providedIn: 'root' }) | |
export class EventEmitterService { | |
private static emitters: { [notificationName: string]: EventEmitter<any> } = {} | |
static get(notificationName: string): EventEmitter<any>{ | |
if (!this.emitters[notificationName]) |
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 { Injectable } from '@angular/core'; | |
import { APP_CONSTANTS } from '@constants/app.constants'; | |
import { Storage } from '@ionic/storage'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class StorageService { | |
private _storage: Storage | null = 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 { Injectable } from '@angular/core'; | |
import { APP_CONSTANTS } from '@constants/app.constants'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class LocalStorageService { | |
constructor() { } |
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 { Injectable } from '@angular/core'; | |
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
/**SERVICES */ | |
import { AuthService } from '@pages/auth/shared/services/auth/auth.service'; | |
@Injectable({ | |
providedIn: 'root' | |
}) |
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
/* | |
arr = [ {id: 1, name: 'Foo'}, {id: 1, name: 'Foo'}] | |
*/ | |
let noDuplicates = arr.filter((obj_a, index, self) => | |
index === self.findIndex((obj_b) => ( | |
obj_a.attr === obj_b.attr //CHANGE attr for any attribute, like id | |
)) | |
) |