我想在用户点击联系人标题时显示模态。 我有一个包含50个联系人的数组,我正在显示所有元素:
Natha Delarue
CEO Sikka
sikka@mail.com(work)
+33 5 99 31 86 36 (work)
Sikka.com (work)
http://sikka.com (work)
Paul kalbernner
...
我希望当我点击联系人标题(姓名,名字)加载模式以打印其他内容(签名,例如,推特......)
这是我的代码: 莫代尔:
<div class="modal fade hide" data-bind="modal: viewModel.ui.FlashbackReport.selected">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3>Edit Record</h3>
</div>
<div class="modal-body">
<div> Contenu signature </div>
</div>
</div>
显示所有信息:
<div id="retrievedContactsDiv" data-bind="foreach: viewModel.MoreContacts.contacts()">
<a href="#" data-bind="text: $data.contactTitle(), click: viewModel.ui.FlashbackReport.selected"></a>
<!-- ko foreach: $data.organizations() -->
.......
<!-- ko foreach: $data.emails() -->
.....
选择初始化
viewModel.ui.FlashbackReport = {
selected: ko.observable(), }