import { Injectable } from '@angular/core' ; import { BrowserStorage } from './browser-storage.service' ; export interface IContactPreference { key : string ; value : string | object ; } @ Injectable ( ) export class PreferencesService { constructor ( private browserStorage ) { } public saveProperty ( preference ) { if ( ! preference . key . length ) { throw new Error ( 'saveProperty requires a non-blank property name' ) ; } this . browserStorage . setItem ( preference . key , preference . value ) ; } public getProperty ( key ) { return this . browserStorage . getItem ( key ) ; } }