Модал ngx-bootstrap (ng6 / bs4) с использованием с angular2-draggable, не перетаскивает весь модал только внутрь - PullRequest
0 голосов
/ 14 ноября 2018

Итак, у меня есть приложение, которое сделано в ng6 и bs4.x

Я установил angular2 / draggable отсюда: Angular Draggable

И я 'мы использовали пример для модального режима здесь: ngx-bootstrap / modal

Если вы прокрутите вниз до: Component #, вы увидите пример, который я привел ниже.

ШАБЛОН:

<button type="button" class="btn btn-primary" (click)="openModalWithComponent()">Create modal with component</button>

КОМПОНЕНТ:

import {Component, OnInit} из '@ angular / core';import {BsModalService, BsModalRef} из 'ngx-bootstrap / modal';

@Component({
  selector: 'demo-modal-service-component',
  templateUrl: './service-component.html'
})
export class DemoModalServiceFromComponent {
  bsModalRef: BsModalRef;
  constructor(private modalService: BsModalService) {}

  openModalWithComponent() {
    const initialState = {
      list: [
        'Open a modal with component',
        'Pass your data',
        'Do something else',
        '...'
      ],
      title: 'Modal with component'
    };
    this.bsModalRef = this.modalService.show(ModalContentComponent, {initialState});
    this.bsModalRef.content.closeBtnName = 'Close';
  }
}

/* This is a component which we pass in modal*/

@Component({
  selector: 'modal-content',
  template: `
    <div class="modal-header">
      <h4 class="modal-title pull-left">{{title}}</h4>
      <button type="button" class="close pull-right" aria-label="Close" (click)="bsModalRef.hide()">
        <span aria-hidden="true">&times;</span>
      </button>
    </div>
    <div class="modal-body">
      <ul *ngIf="list.length">
        <li *ngFor="let item of list">{{item}}</li>
      </ul>
    </div>
    <div class="modal-footer">
      <button type="button" class="btn btn-default" (click)="bsModalRef.hide()">{{closeBtnName}}</button>
    </div>
  `
})

export class ModalContentComponent implements OnInit {
  title: string;
  closeBtnName: string;
  list: any[] = [];

  constructor(public bsModalRef: BsModalRef) {}

  ngOnInit() {
    this.list.push('PROFIT!!!');
  }
}

Функция DRAGGABLE работает, но в моем примере это то, что происходит:

Наконец, вот мой @компонент ({...})

, который я использовал для замены базового модального кода в коде для ngx-bootstrap, как показано выше ...

The Modal as it appears when opened

The Modal when I try to DRAG the container but the modal-content moves OUTSIDE of the container

Here's the way the modal looks inside the Elements Tab of Google

Пожалуйста, сообщите ...

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...