Promact / md2

Angular2 based Material Design components, directives and services are Accordion, Autocomplete, Collapse, Colorpicker, Datepicker, Dialog(Modal), Menu, Multiselect, Select, Tabs, Tags(Chips), Toast and Tooltip.
http://code.promactinfo.com/md2/
MIT License
379 stars 112 forks source link

Md2Dialog causing issues when navigating through router from it #288

Open alexmba94 opened 6 years ago

alexmba94 commented 6 years ago

Bug, feature request, or proposal:

I believe there's a problem with md2Dialog when trying to redirect to a diferent angular component from the dialog.

What is the expected behavior?

I'm using a md2Dialog to display an input type text and a button. Clicking on that button, it checks what is typed on the input and does a request to my server. If it returns a number, then you're redirected to another component with this._router.navigate(['expediente', num]);

And in my app-routing.module, that route exists: { path: 'expediente/:id', component: ExpedienteComponent, canActivate: [AuthGuard] }

(AuthGard returns true for now).

What is the current behavior?

Well, instead of taking me to that component, there's an error : "Uncaught (in promise): Error: no elements in sequence Error: no elements in sequence at EmptyError.ZoneAwareError (http://localhost:4200/vendor.bundle.js:70257:33) at new EmptyError (http://localhost:4200/vendor.bundle.js:62472:26) at FirstSubscriber.webpackJsonp.../../../../rxjs/operator/first.js.FirstSubscriber._complete (http://localhost:4200/vendor.bundle.js:54319:31) at FirstSubscriber.webpackJsonp.../../../../rxjs/Subscriber.js.Subscriber.complete (http://localhost:4200/vendor.bundle.js:44361:18) at Subject.webpackJsonp.../../../../rxjs/Subject.js.Subject.complete (http://localhost:4200/vendor.bundle.js:44108:21) at OverlayRef.webpackJsonp.../../../../md2/core/overlay/overlay-ref.js.OverlayRef.dispose (http://localhost:4200/vendor.bundle.js:14140:29) at Md2Dialog.webpackJsonp.../../../../md2/dialog/dialog.js.Md2Dialog.destroyPanel (http://localhost:4200/vendor.bundle.js:20939:30) at Md2Dialog.webpackJsonp.../../../../md2/dialog/dialog.js.Md2Dialog.ngOnDestroy (http://localhost:4200/vendor.bundle.js:20891:58) at callProviderLifecycles (http://localhost:4200/vendor.bundle.js:121436:18) at callElementProvidersLifecycles (http://localhost:4200/vendor.bundle.js:121405:13) at callLifecycleHooksChildrenFirst (http://localhost:4200/vendor.bundle.js:121389:17) at destroyView (http://localhost:4200/vendor.bundle.js:122737:5) at callViewAction (http://localhost:4200/vendor.bundle.js:122886:13) at execComponentViewsAction (http://localhost:4200/vendor.bundle.js:122798:13) at destroyView (http://localhost:4200/vendor.bundle.js:122736:5)"

I'm not redirected anywhere, and the content of the component in which I was before is now blank. I put an alert on this other component's constructor to see if at least it gets there, but it doesn't.

What are the steps to reproduce?

I can't reproduce it in a plnkr :/ I don't know how

Which versions of Angular, MD2, OS, browsers are affected?

md2 0.0.29 angular 4.2.0

leozero commented 6 years ago

Same problem for me, I tried to close the dialog in the ngDestroy method but it's not working.

alexmba94 commented 5 years ago

It's been almost a year and the problem persists.