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

fix(dialog): reintroduce config property in MdDialogRef #3971

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@ciesielskico

ciesielskico commented Apr 8, 2017

Fixes #3970

@googlebot googlebot added the cla: yes label Apr 8, 2017

@crisbeto

This comment has been minimized.

Show comment
Hide comment
@crisbeto

crisbeto Apr 8, 2017

Member

Removing the config from the DialogRef was a very deliberate decision that can't really be considered a regression, It was removed, because it doesn't need to be in the DialogRef since it isn't being used by it at all. Looking at your issue, it seems like you're using it to access the data, however the proper way to do it is to inject the MD_DIALOG_DATA token:

import {Inject} from '@angular/core';
import {MD_DIALOG_DATA} from '@angular/material';

@Component({
  selector: 'some-dialog',
  template: `...`
})
export class SomeDialog {
  constructor(@Inject(MD_DIALOG_DATA) data: any) {
    console.log(data);
  }
}

Even though you shouldn't need to do this, you can still access the config directly via dialogRef._containerInstance.config.

Member

crisbeto commented Apr 8, 2017

Removing the config from the DialogRef was a very deliberate decision that can't really be considered a regression, It was removed, because it doesn't need to be in the DialogRef since it isn't being used by it at all. Looking at your issue, it seems like you're using it to access the data, however the proper way to do it is to inject the MD_DIALOG_DATA token:

import {Inject} from '@angular/core';
import {MD_DIALOG_DATA} from '@angular/material';

@Component({
  selector: 'some-dialog',
  template: `...`
})
export class SomeDialog {
  constructor(@Inject(MD_DIALOG_DATA) data: any) {
    console.log(data);
  }
}

Even though you shouldn't need to do this, you can still access the config directly via dialogRef._containerInstance.config.

@amivit

This comment has been minimized.

Show comment
Hide comment
@amivit

amivit Nov 6, 2017

How else can I this.dialogRef.close(); ?

amivit commented Nov 6, 2017

How else can I this.dialogRef.close(); ?

@crisbeto

This comment has been minimized.

Show comment
Hide comment
@crisbeto

crisbeto Nov 6, 2017

Member

You can still dialogRef.close @amivit, this issue was regarding the dialogRef.config property.

Member

crisbeto commented Nov 6, 2017

You can still dialogRef.close @amivit, this issue was regarding the dialogRef.config property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment