question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Overlays in 2.0.0-beta.11

See original GitHub issue

Short description of the problem:

After upgrading to beta.11 (which I had to do because it finally brings support for @angular/forms) and applying the code changes suggested in the upgrade guide (use AlertController.create, and alert.present rather than NavController.present) my app is broken. I think this is because of the decision to make overlays global (app-wide) rather than constrained by the containing NavController.

Running the following code in my app results in an error (the same code used to work in beta.10 using nav.present):

const alert = this.alertController.create({/*some options*/);
alert.present().

The above code results in the following error:

TypeError: Cannot read property 'insertViews' of undefined
    at App.present (eval at <anonymous> (main.bundle.js:1), <anonymous>:171:28)
    at Alert.present (eval at <anonymous> (main.bundle.js:1), <anonymous>:98:26)
    at DialogExplorerComponent.addNode (eval at 1473 (1.chunk.js:1), <anonymous>:138:16)

Stepping through the code in the debug console reveals that the _portal field of that App instance is undefined: image

Is there some way of using the beta.11 API to achieve the same behavior as beta.10, that is, having overlays be constrained by their containing NavController rather than app-wide as in beta 11?

What behavior are you expecting?

That I’d be able to use overlays like Alert, Toast as I could in beta.10.

Which Ionic Version? 1.x or 2.x 2.0.0-beta.11

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:25 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
TheMadBugcommented, Aug 8, 2016

Not sure if this is due to the same root cause, but for me I’ve found DI has broken for my popups. Upgraded to Beta 11 and changed how Popup’s get created to be via the PopupController with constructor injection. A vanilla popup works fine, but if the component that we’re passing into the popup relies on a custom service that we put in the root component’s providers, it can’t seem to find it where previously it did. So just end up getting a “No provider for XXXX”.

1reaction
jimitndiayecommented, Aug 8, 2016

@szerner @TheMadBug I’m wondering if issue #7592 might not be the ultimate culprit here. Obviously there’s been a change in beta 11 affecting DI and I’m wondering if the injectors used on portals/overlays/navs etc in beta 11 are properly reusing their parent injectors. It could explain why we’re getting null reference errors (we could be getting a new instance of App instead of the preconfigured global instance resulting in an undefined _portal because setPortal was never called on that instance). Injector inheritance should follow the ng2 model and registering providers in ionicBootstrap alone is not a solution for that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-overlays - npm
Start using react-overlays in your project by running `npm i react-overlays`. There are 586 other projects in ... 2.0.0-0 ... 1.0.0-beta.11.
Read more >
[Beta 11] Overlays problems - ionic-v3 - Ionic Forum
Hi, I have troubles with the new overlays in beta 11. ... [Beta 11] Overlays problems · Ionic Framework ionic-v3 ... Ionic Framework...
Read more >
Angular Material 2.0.0-beta.11 is out - new stepper component ...
overlay : Now that the Overlay is part of the cdk rather than Angular Material directly, the themeClass property has been removed. To...
Read more >
react-overlays - NPM Package Overview - Socket - Socket.dev
Utilities for creating robust overlay components. ... Start using Socket to analyze react-overlays and its 8 dependencies to secure your app from supply ......
Read more >
react-overlays - CodeSandbox
VS Code's tsserver was deleted by another application such as a misbehaving virus detection tool. Please reinstall VS Code. Manage Extension.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found