加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

如何将数据传递给Angular ng-bootstrap模式进行绑定

发布时间:2020-12-17 17:47:21 所属栏目:安全 来源:网络整理
导读:场景: ChildComponent – 拥有大量ngModel绑定元素. ; ParentComponent – btn.onClick = function(){this.bsModalRef = this.modalService.open(ChildComponent,TryToPassDataModel);} 这适用于ngx-bootstrap,但是如何在nb-bootstrap中实现呢? (看起来这
场景:

> ChildComponent – 拥有大量ngModel绑定元素. ;
> ParentComponent – btn.onClick = function(){this.bsModalRef =
this.modalService.open(ChildComponent,TryToPassDataModel);}
这适用于ngx-bootstrap,但是如何在nb-bootstrap中实现呢? (看起来这么简单)

解决方法

看起来你没有正确使用API??.该插件希望params作为@Input()传递.像这样的东西会起作用:

const modalRef = this.modalService.open(NgbdModalContent);
modalRef.componentInstance.name = 'World';

确保在ModalContent组件中为模型添加@Input!

有关详细信息,请参阅doc:https://ng-bootstrap.github.io/#/components/modal/examples

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读