Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog Component Instance #4815

Closed
Kyderman opened this issue May 26, 2017 · 5 comments · Fixed by #4827
Closed

Dialog Component Instance #4815

Kyderman opened this issue May 26, 2017 · 5 comments · Fixed by #4827
Assignees

Comments

@Kyderman
Copy link

Bug, feature request, or proposal:

In Beta 6 (maybe 4 / 5), I cant seem to access anything from dialogRef.componentInstance.

What is the expected behavior?

e.g dialogRef.componentInstance.isSaved would return me the value of isSaved from the component.

What is the current behavior?

componentInstance is null, there is no way to access the inner variables of the dialog.

What are the steps to reproduce?

try using componentInstance after close

What is the use-case or motivation for changing an existing behavior?

I want to know the certain state of a dialog after close.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Material Beta 6, Angular 4

@crisbeto crisbeto self-assigned this May 26, 2017
@Kyderman
Copy link
Author

Im assuming I need to use an emitter, however, I don;t think there is nice documentation on this.
Additionally, it seems like more work to have to construct an output to get these variables.
If that's the case, cant the dialog self emit its state on close?

@Kyderman
Copy link
Author

UPDATE:
I accomplished this by using EventEmitter between the components.
No idea if I need to unsubscribe on close though to stop the subscription from being held in memory?

crisbeto added a commit to crisbeto/material2 that referenced this issue May 26, 2017
Fixes the `dialogRef.componentInstance` being cleaned up too early, causing it to be unavailable in the `afterClosed` callback.

Fixes angular#4815.
crisbeto added a commit to crisbeto/material2 that referenced this issue May 26, 2017
Fixes the `dialogRef.componentInstance` being cleaned up too early, causing it to be unavailable in the `afterClosed` callback.

Fixes angular#4815.
@oraum
Copy link

oraum commented May 30, 2017

I think you need neither the componentInstance nor an EventEmitter to access the values in afterClose - simply pass them as parameter to the close method of the dialogRef

andrewseguin pushed a commit that referenced this issue Jun 5, 2017
Fixes the `dialogRef.componentInstance` being cleaned up too early, causing it to be unavailable in the `afterClosed` callback.

Fixes #4815.
@ghost
Copy link

ghost commented Oct 6, 2017

We are currently on 2.0.0-beta.10. componentInstance is null on quite a regular basis for most dialogs. Unfortunately, we could not pin down the cause.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants