import { ElementRef , Injectable } from '@angular/core' ; import { NodeUtils } from './node.utils' ; @ Injectable ( ) export class StorageService { private getConceptAlias ( elem ) { return NodeUtils . GetConceptAliasOfNode ( elem . nativeElement ) ; } setItem ( elem , key , value ) { const itemKey = `${ this . getConceptAlias ( elem ) }-${ key }` ; localStorage . setItem ( itemKey , JSON . stringify ( value ) ) ; } getItem ( elem , key ) { const itemKey = `${ this . getConceptAlias ( elem ) }-${ key }` ; return JSON . parse ( localStorage . getItem ( itemKey ) ) ; } removeItem ( elem , key ) { const itemKey = `${ this . getConceptAlias ( elem ) }-${ key }` ; localStorage . removeItem ( itemKey ) ; } }