【问题标题】:ngx-bootstrap modal not detecting my component propertiesngx-bootstrap 模式未检测到我的组件属性
【发布时间】:2018-01-05 02:21:41
【问题描述】:

我正在将 ngx-bootstrap 用于 bootstrap 3.3.7,目前正试图让模态服务完全工作。模式对话框打开,但出现的唯一内容是静态内容。我传递给服务的动态内容都不起作用,主要是因为 bsModalRef 似乎没有获取我的组件属性。

这是 Modal 组件:

import { BsModalRef } from 'ngx-bootstrap/modal/modal-options.class';
import { Component } from '@angular/core';
import { CallCenter } from 'app/shared/dsg/models/models';

@Component({
  selector: 'dsg-call-centers-dialog',
  templateUrl: './call-centers-dialog.component.html',
  styleUrls: ['./call-centers-dialog.component.scss']
})
export class CallCentersDialogComponent {
  public data: CallCenter[] = [];

  constructor(public bsModalRef: BsModalRef) { }

}   

然后在我的宿主组件中,这是打开对话框的代码sn-p:

this.bsModalRef = this._modalService.show(CallCentersDialogComponent);
this.bsModalRef.content.data = this.itemData;  // Property 'data' does not exist on type 'Object'

所以对话框按原样打开,但我的对话框组件的数据属性不可用。

我错过了什么?

【问题讨论】:

  • 你有没有让这个工作?我正在使用 1.8.1。并做同样的事情,但结果相同。
  • @nbppp2 - 不,我最终改用了 ng2-bootstrap-modal。它工作正常。

标签: angular bootstrap-modal ngx-bootstrap


【解决方案1】:

这在 ngx-bootstrap 的 1.8.1 中已修复,试试吧

【讨论】:

  • 他说他用的是3.3.7版本,那你的回答对你有什么帮助?
  • 我说的是 ngx-bootstrap,而不是 bootstrap
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-12-09
  • 2019-04-26
  • 1970-01-01
  • 2019-04-15
  • 1970-01-01
  • 1970-01-01
  • 2020-10-03
相关资源
最近更新 更多