import { Injectable } from '@angular/core' ; @ Injectable ( ) export class DataSharingService { private data : any = { } ; constructor ( ) { } getDataForKey ( key ) { return this . data [ key ] ; } setDataForKey ( key , data ) { this . data [ key ] = data ; } deleteDataForKey ( key ) { delete this . data [ key ] ; } }