标签: ngx-modal

ngx-bootstrap modal:如何将数据传递到modal component.ts而不是html模板?

我能够收集对象中传递的数据initialState,例如在这段代码中:

\n\n
   const initialState = {\n        titulo: titulo,\n        origen: origen,\n        th1: "N\xc3\xbamero",\n        th2: "Nombres",\n        modalFor: "Locales"\n      };\n      this.bsModalRef = this.modalService.show(ClienteOlocalPopUpComponent, {\n        initialState,\n        backdrop: "static",\n        keyboard: false\n      });\n
Run Code Online (Sandbox Code Playgroud)\n\n

并在 ClienteOlocalPopUpComponent.html 中插入其属性。

\n\n

但是,如果我希望传递给模态的值const initialState,比方说,通过ngOnInit()ClienteOlocalPopUpComponent.ts \xc2\xbf 的方法在控制台中打印,我该如何实现呢?它在模态的 .ts 文件中无法识别。

\n\n

谢谢。

\n\n

这是启动模式的组件的代码:

\n\n
 openModal(origen, titulo) {\n    this.origen = origen;\n\n    if (origen === "cliente") {\n      const initialState = {\n        titulo: titulo,\n        origen: origen,\n        th1: "RUT",\n        th2: "Nombres",\n        modalFor: "Clientes",\n        rutClientes: this.requestTres.rutCliente,\n        rutOperador: this.requestTres.rutOperador\n      };\n      this.bsModalRef …
Run Code Online (Sandbox Code Playgroud)

ngx-modal ngx-bootstrap angular

3
推荐指数
1
解决办法
6894
查看次数

标签 统计

angular ×1

ngx-bootstrap ×1

ngx-modal ×1