Can't create alert on modal dismiss

Hi,

From a regular page, I am opening a modal. Once returned from it, the modal.onDismiss is called.

In onDismiss, I call a http and subscribe to it. Once the data returned, I want to call an alert. Something like

modal.onDismiss(modalData) {
  this.myService.callHttp().subscribe(
  data => {
     let alert = Alert.create({title: 'Alert', buttons: [Ok]});
     this.nav.present(alert);
}, ....);

The alert is shown, but I get a black screen behind and the error

EXCEPTION: TypeError: Cannot read property ‘nativeElement’ of undefined

Any clue?

1 Like