Hello,
I suspect a timming problem.
let alert = this.alertCtrl.create({ is a asyncrouns call and is not awaited
this.updateStorage(this.productdetail).catch returns a promise
alert.present(); is a asyncrouns call and is not awaited
this.changeDetector.detectChanges(); maybe the try to fix timming problem with that?
this.storage.get(‘products’).then((data) => { is a promise
async calls return the controll to caller, so the next line of code will executed, but the async call will be executed anywhen.
promises are simillar.
For example: this.alertCtrl.create is exectued async, in between it exectues the next lines of your code. If your async call is not fix enougt, the line alert.present crash with undefined error, because let alert has no value at that time.
Best regards, anna-liebt