Error while getting value from ionic storage to http service

i am getting error while using this code.

viewNotifications(){
let headers = new Headers();
this.storage.get(‘currentUser’).then((val)=>{
let tokenauth = JSON.parse(val);
this.token = tokenauth.token;
headers.append(‘Authorization’, this.token);
let opts = new RequestOptions();
opts.headers = headers;
return this.http.get(‘http://localhost/getnotification’,opts)
.map(res => res.json());
});
}

<---------error----------->
ERROR Error: Uncaught (in promise): TypeError: Cannot read property ‘subscribe’ of undefined
TypeError: Cannot read property ‘subscribe’ of undefined
at TabsPage.webpackJsonp.169.TabsPage.ngOnInit (tabs.ts:22)
at checkAndUpdateDirectiveInline (core.js:12095)
at checkAndUpdateNodeInline (core.js:13598)
at checkAndUpdateNode (core.js:13541)
at debugCheckAndUpdateNode (core.js:14413)
at debugCheckDirectivesFn (core.js:14354)
at Object.eval [as updateDirectives] (TabsPage_Host.ngfactory.js? [sm]:1)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:14339)
at checkAndUpdateView (core.js:13508)
at callWithDebugContext (core.js:14740)
at TabsPage.webpackJsonp.169.TabsPage.ngOnInit (tabs.ts:22)
at checkAndUpdateDirectiveInline (core.js:12095)
at checkAndUpdateNodeInline (core.js:13598)
at checkAndUpdateNode (core.js:13541)
at debugCheckAndUpdateNode (core.js:14413)
at debugCheckDirectivesFn (core.js:14354)
at Object.eval [as updateDirectives] (TabsPage_Host.ngfactory.js? [sm]:1)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:14339)
at checkAndUpdateView (core.js:13508)
at callWithDebugContext (core.js:14740)
at c (polyfills.js:3)
at Object.reject (polyfills.js:3)
at NavControllerBase._fireError (nav-controller-base.js:223)
at NavControllerBase._failed (nav-controller-base.js:216)
at nav-controller-base.js:263
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.js:4629)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
defaultErrorLogger @ core.js:1350
ErrorHandler.handleError @ core.js:1411
IonicErrorHandler.handleError @ ionic-error-handler.js:61
next @ core.js:5376
schedulerFn @ core.js:4223
SafeSubscriber.__tryOrUnsub @ Subscriber.js:238
SafeSubscriber.next @ Subscriber.js:185
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ core.js:4203
(anonymous) @ core.js:4651
t.invoke @ polyfills.js:3
r.run @ polyfills.js:3
NgZone.runOutsideAngular @ core.js:4577
onHandleError @ core.js:4651
t.handleError @ polyfills.js:3
r.runGuarded @ polyfills.js:3
(anonymous) @ polyfills.js:3
n.microtaskDrainDone @ polyfills.js:3
o @ polyfills.js:3
e.invokeTask @ polyfills.js:3
p @ polyfills.js:2
v @ polyfills.js:2
XMLHttpRequest.send (async)
s @ polyfills.js:3
t.scheduleTask @ polyfills.js:3
onScheduleTask @ polyfills.js:3
t.scheduleTask @ polyfills.js:3
r.scheduleTask @ polyfills.js:3
r.scheduleMacroTask @ polyfills.js:3
(anonymous) @ polyfills.js:3
o.(anonymous function) @ polyfills.js:2
(anonymous) @ http.js:1605
Observable._trySubscribe @ Observable.js:172
Observable.subscribe @ Observable.js:160
webpackJsonp.112.LoginPage.onSubmit @ login.ts:41
(anonymous) @ LoginPage.html:18
handleEvent @ core.js:13255
callWithDebugContext @ core.js:14740
debugHandleEvent @ core.js:14327
dispatchEvent @ core.js:9704
(anonymous) @ core.js:12028
schedulerFn @ core.js:4235
SafeSubscriber.__tryOrUnsub @ Subscriber.js:238
SafeSubscriber.next @ Subscriber.js:185
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ core.js:4203
FormGroupDirective.onSubmit @ forms.js:6722
(anonymous) @ LoginPage.html:18
handleEvent @ core.js:13255
callWithDebugContext @ core.js:14740
debugHandleEvent @ core.js:14327
dispatchEvent @ core.js:9704
(anonymous) @ core.js:10318
(anonymous) @ platform-browser.js:2614
t.invokeTask @ polyfills.js:3
onInvokeTask @ core.js:4620
t.invokeTask @ polyfills.js:3
r.runTask @ polyfills.js:3
e.invokeTask @ polyfills.js:3
p @ polyfills.js:2
v @ polyfills.js:2

This error should be related to your HTML code, perhaps you are using an Observable inside the HTML view from the function you posted? If that’s the case, try to use the Angular async pipe.

Otherwise, please also show the code of your view as this error is not exactly coming from the code you posted.