【发布时间】:2017-04-23 07:35:58
【问题描述】:
在 angular2 项目中使用 Bootstrap 4,在一个组件中的多个组件中但是,我的模态出现在灰色渐变(背景)下方并且不可编辑。
firstComponent.html
<batopPage>
<button class="btn btn-success" (click)="lgModal.show()">Large modal</button>
<!-- Large modal -->
<div bsModal #lgModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button class="close" (click)="lgModal.hide()" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Large modal</h4>
</div>
<div class="modal-body">
suscipit lobortis nisl ut aliquip ex ea commodo consequat.
</div>
<div class="modal-footer">
<button class="btn btn-primary confirm-btn" (click)="lgModal.hide()">Save changes</button>
</div>
</div>
</div>
</div>
</batopPage>
firstComponent.ts
@Component({
selector: 'firstcomponent',
template: require('./firstComponent.html')
})
export class Modals {
@ViewChild('childModal') childModal: ModalDirective;
showChildModal(): void {
this.childModal.show();
}
hideChildModal(): void {
this.childModal.hide();
}
}
otherComponent.html
<firstcomponent></firstcomponent>
【问题讨论】:
-
不确定是否有人能够在没有显示您确切代码的最小 plunker 的情况下提供帮助...
-
我对 angular2 一无所知,但您可以随时在此处参考nakupanda.github.io/bootstrap3-dialog。它将使您更容易使用给定的链接管理引导程序。无需自己管理。
标签: twitter-bootstrap angular bootstrap-modal bootstrap-4 ng-bootstrap