-
Notifications
You must be signed in to change notification settings - Fork 92
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 design #131
Comments
I checked now also how dialog behaves after change from
to
The end result is modal that can not be closed because I checked how the md2-dialog works. It also adds backdrop to body, but it also adds the modal inside. See screenshot: |
i have tried to find a solution without accessing the body element. |
Having to import AppComponent from other components complicates usage of the dialog, especially for tests. It would be great improvement to have setDefaultViewContainerRef some default value (maybe the I see its also related to angular/angular#6446 (comment) If this is resolved, this opens way to define modals just in template like the md2-dialog example. |
i know this approach. but this requires that you inject the ViewContainerRef to the Root-App-Component and you don't know why you do this. with setDefaultViewContainerRef i wanted to make this obvious and not so magic :-) |
It possible to remove the need for I think it should be possible to make something like |
sure! this is possible. but then we need to make it more clear that this: this.dialogService.setDefaultViewContainerRef needs to be done in the appcomponent. this is the reason why this is done in the dialogDemo-Component. but this dosen't help either. look here: http://stackoverflow.com/questions/39847890/use-dialog-is-very-complicated :( i agree that this in the current master there are already some changes to the dialog api... |
@tb @mseemann - I had a similar challenge for a dialog component I built; you can see how I solved that here - https://github.com/swimlane/swui/tree/master/src/components/dialog |
@amcdnl yep. so far there are three ways to solve this problem: 'how can i append components to the root application or even better to the document.body' (or variations and combinations of these solutions):
every approach has advantages and disadvantages. right now there seems to be no way in angular2 to achieve this with a solution that "looks right" :( |
@mseemann For me As to second aspect of this ticket - defining The current custom component creation does not allow binding |
@tb i am little bit short of time the next two days. give me some time to think about it. The current design is the way how i usually use such a ui component like a dialog. You are right. you can not use Input or Output. I'm doing this by using a service. about this line: For your further development: just keep this problem as solved and that there is a way to get the viewcontainerref :) I'm sure we will find a solution. |
just a thought to discuss: what if we add a dialog-outlet to the html - something like
how does this "feel"? |
@tb but it looks so cool! ;-) |
@mseemann Yeah, its a little cooler then |
No, no. It's comepletly independent of anything. Sure a little bit complicated to implement. But easy to use. And you can deside where the dialog will be attached to the dom. I havn't developed anything with ember. But it looks really similar... |
Why don't you simply use the Dialog comes with a new pseudo element called |
@grizzm0 sure i thought about it. but there are a lot of reasons why i prefer the old-way:
|
As this lib is basically a wrapper around material-design-lite for angular2 I would suggest using the same behaviour. In this case using the dialog element. Another issue here is So I have no way to provide different data objects for the same dialog component used in different components. |
@grizzm0 can I see any code what you are doing there:
what you are mean with
? |
Sorry, I meant providers, not provides. If I set the default viewContainerRef to the application ref I need to set any injectable service I'm going to use inside the custom dialog in app.module.ts. |
@grizzm0 I'm not quire sure what your problems are. I have updates the example dialog: http://mseemann.io/angular2-mdl/dialogs. If you checkout the sources https://github.com/mseemann/angular2-mdl/tree/angular2-mdl-1.x/src/app/dialog you'll find a login module - this module is the only thing you need to include in your app module. A full encapsulated piece of code. See for example the LoginService. The service isn't known to the app module. Setting the defaultViewContainerRef, like it is done in https://github.com/mseemann/angular2-mdl/blob/angular2-mdl-1.x/src/app/app.component.ts#L103 isn't related to the login modul. |
@tb got the declarative dialog working (master). It would be great if you can take a short look if this works as you did expected it to work! There is one open issue: it is only possible to create one instance of such an embedded dialog - but i think this is not a blocker. |
@mseemann Great work! I checked it works great! For my current use cases I have no problem with one instance limitation. Do you think its fixable in future? |
@tb thx for your feedback! I don't know. This seems to be the way a simple TemplateRef works. Just to make it clear: you can only show one instance at once. but if you have closed the dialog the same dialog can be shown again. closing this issue. need some documentation to do and hopefully release version 2.0 tomorrow. |
I have recently replaced md2-dialog with mdl-dialog. It however creates a lot of extra effort compared to usage of md2-dialog which did not require service / vcRef and I was able to use it with just the directive.
This is example how I was able to use it to build a Confirm component:
I have used this component by wrapping remove icon like this:
The text was updated successfully, but these errors were encountered: