-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
[Bug|self error] md-select in md-dialog can't use providers data #2374
Comments
@icordoba8 take a look. |
Can you please provide a codepen so we can investigate further? |
@EladBezalel Can you give me a base pen to start? |
Plunker : http://plnkr.co/edit/o077B6uEiiIgkC0S06dd :) |
Ok here it is, Plunkr local service, just click the button that says Please note that the service is local to the In such case we were forced to deal with it like this, setting the service through the showDialog() {
this.dialogRef = this.dialog.open(CustomerDialogComponent, {
disableClose: false
});
this.dialogRef.componentInstance.customerService = this.customerService;
this.dialogRef.afterClosed().subscribe(result => {
console.log('result: ' + result);
this.dialogRef = null;
});
} |
Took me a while to realize you forgot to include your service as a provider 😅 |
For the love of ... You didn't understand my point, i don't want a singleton provider available to the full app, i want a local provider to the customer component. Originally in my project there is an The issue is that the local provider isn't available to the I mean, did you look at the CustomerComponent providers section in my pen? maybe should i have used an Order analogy with 2 different instances? I want to be able to have multiple component instances, each instance would have it's own |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Bug or misconfiguration.
What is the expected behavior?
I was expecting the dialog component to have available the same service instance of the caller(parent) component, but that service is local to the caller(parent) component, after that i request some data and put that in the
md-select
, and set a default.I set the default value from the caller(parent) component through the instance of the dialog component.
What is the current behavior?
I'm forced to open the dialog, get the dialog instance and set the service manually instead of asking for it to the injector.
However it doesn't end there, i had to set the value from the parent component, then in the dialog component was getting the select data from service, but the default selected value wasn't being set.
I'm forced to both pass the default selected value as well as the options data from the parent through the instance of the dialog component.
What is the use-case or motivation for changing an existing behavior?
Harder to deal with if we need to set everything from the parent through the instance of the dialog component instead of using the injector.
Which versions of Angular, Material, OS, browsers are affected?
Angular: 2.2.1
Material: 2.0.0-beta.0
Browser: Chrome 55.0.2883.95
Is there anything else we should know?
I suspect it has to do with the value being set before the data for the select is available.
Maybe the value set from the parent through instance is outside of thengZone
?Scratch the last sentence, it is in the zone since it works when i set all from the parent through the instance of the
md-dialog
component.The text was updated successfully, but these errors were encountered: