ngx-bootstrap:模态打开为小而不是大

时间:2017-10-18 17:09:14

标签: twitter-bootstrap angular ngx-bootstrap

我从另一个组件调用一个模态,问题是我只能将它打开为小而不是大

comp1.html

<marquee><p id="quote"></p></marquee>

comp1.ts

<button type="button" class="btn btn-outline-primary btn-lg" (click)="openModal()">Upload

modal.component.ts

import {modalComponent} from '../pages/modals/new-modal';

private modalService: BsModalService

constructor(private modalService: BsModalService)

openModal() {
    this.bsModalRef = this.modalService.show(modalComponent);
 }

modal.html

constructor(private modalService: BsModalService, public bsModalRef: BsModalRef)

2 个答案:

答案 0 :(得分:10)

试试这样:

openModal() {
    this.bsModalRef = this.modalService.show(modalComponent, {class: 'modal-lg'});
}

答案 1 :(得分:2)

如果要在打开模式时将数据传递给模式组件,则

openModal() {
   const initialState = {
     data:"Test data"
   }
   this.bsModalRef = this.modalService.show(modalComponent, {initialState, class: 'modal-lg'});
}