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

Improve Component: Modal #29

Open
langdonx opened this issue Aug 1, 2017 · 6 comments
Open

Improve Component: Modal #29

langdonx opened this issue Aug 1, 2017 · 6 comments

Comments

@langdonx
Copy link
Collaborator

langdonx commented Aug 1, 2017

Allow the modal service to accept a component, its bindings, and then allow that component to manage the modal and return data to the caller. It doesn't appear that you can do this currently.

@langdonx
Copy link
Collaborator Author

langdonx commented Aug 1, 2017

UI Bootstrap has support for this concept, but it doesn't do that great a job with it. It'd be nice to see modals with component support, more similar to how UI Router handles components. Meaning that a component doesn't have to be designed to work with UI Router... UI Router can reference any component and pass necessary bindings to it. UI Bootstrap, on the other hand, asks that components take a specific set of bindings:

{
    close: '&',
    dismiss: '&',
    modalInstance: '<,'
    resolve: '<',
}

...and call close or dismiss to resolve or reject the Promise. Fixing the mandatory resolve bit seems quite possible, but resolving the Promise might be more tricky. One way or another, the component has to be aware that it is being used inside of a modal if it wants to communicate with whatever code opened it. Perhaps an AngularJS Service can somehow bind the two together, rather than relying on a binding to inject info. I imagine they injected resolve instead of each individual binding simply to avoid naming collisions, but I'm not sure. If a Service isn't the solution, maybe a more uniquely named binding could do the trick and allow the component to not have to be a modal-only component.

@IdanCo
Copy link
Owner

IdanCo commented Aug 1, 2017

I was banging my head on how to approach it, I think the component idea could be an excellent solution. And a service to make the component aware of the modal and communicate with the "parent" controller really sounds like the right approach.

I'll play around with it a little and come back with more thoughts...

selvach added a commit to selvach/ng1bs4 that referenced this issue Sep 1, 2017
@nvivo
Copy link

nvivo commented Oct 20, 2017

@IdanCo,

I use UI Bootstrap modal extensively to do complex screens. Component support is mandatory to keep this simple. Currently, UI Bootstrap supports components and allows me to do:

var instance = $uibModal.open({ component: someModalComponent });

What would it take to support it and do you need help implementing it?

@IdanCo
Copy link
Owner

IdanCo commented Oct 20, 2017

@nvivo I totally agree and any help would be highly appreciated!

I admit I'm not sure how to approach this, so even a partial PR to help us get started will be welcomed...

@jbeaudoin11
Copy link

I'm also interested into this !

@nvivo
Copy link

nvivo commented Nov 2, 2017

I have been thinking about this and wondering, and I know this may be too late, but why re-invent everything to support BS4 if most of the changes are in the HTML? Why not simply fork the current version and do the changes to the templates and properties? Wouldn't it be much easier than starting from scratch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants