私は、アイテムの詳細を表示するにはng2-bootstrap modal各アイテムの詳細をモーダルng2ブートストラップに渡すにはどうすればよいですか?
を使用しています。それぞれのアイテムをクリックすると、それぞれの詳細がモーダルに表示されます。私は私が唯一、それぞれのユーザーその他の詳細を通過したいそれぞれの行をクリックすると、ここで
は私のコード
<table class="table table-hover table-bordered table-striped tableheader">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Gender</th>
<th>City</th>
<th>Country</th>
<th>Age</th>
</tr>
</thead>
<tbody *ngFor="let item of results$ | async" >
<tr (click)="lgModal.show(item)">
<td>
{{item.firstName}}
</td>
<td>{{item.lastName}}</td>
<td>{{item.gender}}</td>
<td>{{item.city}}</td>
<td>{{item.country}}</td>
<td>{{item.age}}</td>
</tr>
</tbody>
</table>
ですが、それは同じであるモーダルに私の結果$の完全なJSONを渡していますコンポーネント
<div bsModal #lgModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" (click)="lgModal.hide()" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Complete Details</h4>
</div>
<div class="modal-body">
<div >
{{ item | json }} // not getting item details here
</div>
</div>
</div>
</div>
</div>
これをどのように行うには?
のみのパスで
私component.htmlでそれ データインスタンスをモーダルに変換し、モーダルでデータ(結果$)を再度繰り返します。 – Manish
@ user32私はモーダルにデータを渡すことができるように私はカスタム関数を書くことができます –
私は1つのことを教えてくれますか?モーダルHTMLは同じコンポーネント内にあるか、別のコンポーネント内にあります。その場合は、コンポーネント通信のために移動する必要があります。 (@入出力)。 – Manish