使用Angular4在引导模式窗口中显示特定数据
如何在引导模式窗口中仅显示特定数据使用Angular4在引导模式窗口中显示特定数据,angular,bootstrapping,modal-window,Angular,Bootstrapping,Modal Window,如何在引导模式窗口中仅显示特定数据 通过在Angular4中使用ngFor循环,您可以尝试将数组传递给ng模板,例如: arrayVar = [ "first value", "sencond value", "third value" ] 然后,您可以使用NGF进行如下操作: <button type="button" class="btn btn-primary" (click)="openModal(template)">Open modal</button
通过在Angular4中使用ngFor循环,您可以尝试将数组传递给ng模板,例如:
arrayVar = [
"first value",
"sencond value",
"third value"
]
然后,您可以使用NGF进行如下操作:
<button type="button" class="btn btn-primary" (click)="openModal(template)">Open modal</button>
<ng-template #template class="myClass" myArray="arrayVar">
<div class="modal-header">
<button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div *ngFor="let hero of arrayVar">
<td>{{hero}}</td>
</div>
</div>
</ng-template>
开放模式
&时代;
{{英雄}}
演示使用:
在本例中,您可以将任何需要的内容放入模式中,只需传递所需的数据。请参见“组件作为内容”演示。当我们只显示一个模型窗口时,这很好,但我想显示单独的模式窗口,其中有特定的文本,可以从json检索每个模型的数据。单击divSo时,所有这些都会发生,将参数传递给open()方法,并将此参数传递给模式中显示的组件,就像示例中传递的
name='World'
一样。使用@Input共享数据工作正常,但当我尝试使用modal时,我遇到了以下错误:没有NgbaTiveModel的提供程序!我已经包括了所有的东西。你能帮我吗?你什么都没有包括。你的问题是一个没有任何代码的句子。