![](/img/trans.png)
[英]How to apply width to specific child ngx-bootstrap Modal from parent component CSS
[英]Passing data from ngx-bootstrap Modal to Component
我的组件中有一个阵列驱动程序。 当我单击组件中的按钮时,我正在显示一个 ngx-bootstrap 模式,其值来自驱动程序数组的全名。 现在我想从模式中取回数据,比如选择了哪个名称。 怎么做?
<button type="button" class="btn btn-success btn-round" (click)="staticModal.show()">{{'Assign Driver' | translate}}
</button>`
<div class="modal fade" bsModal #staticModal="bs-modal"
tabindex="-1" role="dialog" aria-labelledby="dialog-static-name">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h4 id="dialog-static-name" class="modal-title pull-left">Select Drivers</h4>
<button type="button" class="close pull-right" aria-label="Close" (click)="staticModal.hide()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div *ngFor= "let dri of drivers">
<input type="radio" id="customRadio1" name="customRadio">
<label>{{dri.fullname}}</label>
</div>
<div class = "modal-footer">
<button type="button" class="btn btn-primary" (click)="staticModal.hide()" >Select Driver</button>
<button type="button" class="btn btn-default" (click)="staticModal.hide()">Cancel</button>
</div>
</div>
</div>
</div>
</div>
我想获取组件中选定单选按钮的值。 当模式关闭时,我想执行我已经执行的方法 placeorder() 如何做到这一点?
open() {
const modalRef = this.modalService.open(NgbdModalContent);
modalRef.componentInstance.data = //'your data want to sent in model';
modalRef.result.then((response) => {
console.log(response);
});
在 Model 组件中
@input() data : any;
closel() {
let data = [1,2,3,4,5,6];
this.activeModal.close(data);
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.