Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Dialog fix #122

Closed
bekos opened this issue Feb 6, 2013 · 12 comments
Closed

Dialog fix #122

bekos opened this issue Feb 6, 2013 · 12 comments

Comments

@bekos
Copy link
Contributor

bekos commented Feb 6, 2013

In case the dialog class i provide through options contains a directive, this is not compiled.

Probably when the modalEl is compiled something like

$compile(self.modalEl.wrap("div").parent().contents())($scope);

would be better.

@ajoslin
Copy link
Contributor

ajoslin commented Feb 6, 2013

Hi bekos!

Thanks for reporting - do you think you could give a working example of this? I don't quite understand the problem.

You can start with http://plnkr.co/edit/7nf4qO?p=preview

@bekos
Copy link
Contributor Author

bekos commented Feb 6, 2013

I talk about the $dialog provider.

Lets say i have already created a draggable directive, restricted in C.

I now set in my options for the $dialog modalClass: 'modal draggable' in order of my modal to be draggabe.
Right now the draggable is ignored because only the modalEl.contents() are compiled.

I hope i made my self clear this time, because im not very familiar with plunker :(

@pkozlowski-opensource
Copy link
Member

Oh, I see. The issue is that we are doing a bit of HTML gluing inside JavaScript:
https://github.com/angular-ui/bootstrap/blob/master/src/dialog/dialog.js#L73
https://github.com/angular-ui/bootstrap/blob/master/src/dialog/dialog.js#L49

We could consider providing a template for it but it might be overkill. Maybe we should just compile the whole modal element?

@pkozlowski-opensource
Copy link
Member

If I'm not mistaken it should be as simple as changing this line:

$compile(self.modalEl.contents())($scope);

@bekos
Copy link
Contributor Author

bekos commented Feb 7, 2013

Yes, the change i suggest in the first comment does the job. I have tested locally and it works fine.
$compile(self.modalEl.wrap("< div ></ div >").parent().contents())($scope);

I should have prepared a pull request, but haven;t done it before :-)

@pkozlowski-opensource
Copy link
Member

@bekos actually it might be enough to change it to $compile(self.modalEl)($scope);, no?

A PR would be awesome, although writing test for this will require a bit of gymnastic.

@pkozlowski-opensource
Copy link
Member

@bekos just pushed a fix. Could you please test a version from http://ci.angularjs.org/job/angularui-bootstrap/ws/dist/ (0.1.1-SNAPSHOT)? Thnx!

@sorbing
Copy link

sorbing commented Apr 19, 2013

How to apply draggable and resizable directives on modal?

@bekos
Copy link
Contributor Author

bekos commented Apr 19, 2013

@sorbing This is not something that is provided out of the box from the library.

An option is to create a custom class (C) directive for your dialog, and implement the desired functionality there.

@sorbing
Copy link

sorbing commented Apr 19, 2013

I have already implemented the directives draggable and resizable. I do not understand how to apply them to the modal window. Thanks for the quick response.
I did so:

<div draggable="" modal="shouldBeOpen" ... >

But because the container with modal directive not display in modal, displays only the inner content..

@bekos
Copy link
Contributor Author

bekos commented Apr 19, 2013

You can override the dialogClass in dialog's configuration options. See the example on project's page how the other options are set.

@sorbing
Copy link

sorbing commented Apr 19, 2013

Many thanks) It's works!

<div modal="shouldBeOpen" close="close()" options="{dialogClass: 'modal draggable'}">...

However, how I can set the parameters for draggable? Example:

<div draggable="{containment: '.selector', scroll: false}" modal="shouldBeOpen">

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

No branches or pull requests

4 participants