Ngx-bootstrap: Is the modal draggable?

Created on 25 May 2017  路  11Comments  路  Source: valor-software/ngx-bootstrap

Hi,

Could you please add draggable support to modal to move around.

Thanks

comp(modal) feat-request

Most helpful comment

a solution for that is to use :

import { AngularDraggableModule } from 'angular2-draggable'; in your app.module .

in your angular's styles.css put :

`.modal-content > .ng-draggable {
background-color: #fff;
}

.backgroundTransparent .modal-content {
background: transparent !important;
}

.modal-content {
background: transparent !important;
border: none;
}`

in your html put a <div ngDraggable> inside your modal's ng-template :

All 11 comments

Hi! This feature isn't a part of original bootstrap modal so we won't include this functionality to the package.
Although you can use this lib https://www.npmjs.com/package/angular2-draggable (just apply ngDraggable directive on .modal-dialog and there you go)

Thanks for the update. I will try using angular2-draggable

Hi! Thanks for the package :) Anyhow, i have a little problem with the modal. Every time I drag it, move it, dissmis it and then opening it again, it opens and the position where it was moved. Is there anyway how the window can "pop up" at the center of the screen, even if I have moved it before? Thanks!

@IlyaSurmay do you have an elegant way to do this? Because i'm using modal service, and I can't access the outer modal.

Is there a way to handle persistence that @zuzhal is referring to?

I wrote a simple library mattxu-zz/ngb-modal-draggable to make ng-bootstrap modal draggable. maybe you could try it.

@IlyaSurmay do you have an elegant way to do this? Because i'm using modal service, and I can't access the outer modal.

@IlyaSurmay @andrea-spotsoftware I have same problem. Using Angular2Dragable(ngDraggable directive). Any solution? Thanks.

I am using jquery ui to make modals draggable.

https://stackoverflow.com/a/53843281/6559330

Simple directive (based on the ngx-modal-draggable library mentioned above) to make an ngx-bootstrap modal draggable: https://gist.github.com/markleusink/7af171d5f17e7dc9714e69965fdabab9

a solution for that is to use :

import { AngularDraggableModule } from 'angular2-draggable'; in your app.module .

in your angular's styles.css put :

`.modal-content > .ng-draggable {
background-color: #fff;
}

.backgroundTransparent .modal-content {
background: transparent !important;
}

.modal-content {
background: transparent !important;
border: none;
}`

in your html put a <div ngDraggable> inside your modal's ng-template :

Was this page helpful?
0 / 5 - 0 ratings