Storing result of this.nativeStorage.getItem() in class variable

I have the following page where I want to set a class variable with the results of a getItem() to native storage. The console.log prints out the expected 55 but I get an error when assigning theData to this.fooBar:

vendor.js:1822 ERROR Error: Uncaught (in promise): TypeError: Cannot set property ‘fooBar’ of undefined TypeError: Cannot set property ‘fooBar’ of undefined

selector: ‘page-dashboard’,
templateUrl: ‘dashboard.html’
export class DashboardPage {
key:string = ‘dst’;
inputValue: number = 55;
fooBar: number;

constructor(public navCtrl: NavController,
public navParams: NavParams,
private nativeStorage: NativeStorage) {

this.nativeStorage.setItem(this.key, this.inputValue);
this.nativeStorage.getItem(this.key).then(function (theData) {
  this.fooBar = theData;


I have a similiar problem i didnt find any answer until now. Did you find a solution?