我試圖完成的結果是,當用戶點擊一個鏈接內聯fancybox用html打開它。當用戶輸入一個值並點擊輸入時,它應該更新(敲除)我的視圖模型,並且該花式框應該面對一個方法。Fancybox與淘汰賽後重新綁定
這是我的代碼到目前爲止,我知道我需要重新申請mybindings,但無法弄清楚如何。
HTML:
<div style="display:none">
<div id="inlineManufacturerAdder">
<div style="width:1000px;">
<!-- In deze div alle content -->
<h2>Add new Manufacturer2</h2>
<p>
<form data-bind="submit: vm.addManufacturer">
<input type="text" data-bind="value: vm.newManufacturer, valueUpdate: 'afterkeydown'" placeholder="New Manufacturer">
</form>
</p>
</div>
</div>
</div>
使用Javascript(打字稿):
export function viewAttached() {
$("a.fancybox-link-add-manufacturer").click(function (e) {
$.fancybox({
content: $('#inlineManufacturerAdder').html(), //this is where it goes wrong, it gets the content and forgets the bindings I guess!
type: 'html'
});
return false;
});
}
如果我使用DIV(也被設置爲顯示:無)在一個正常的方式,使沒有的fancybox一切正常正好。
我該怎麼辦?我正在使用杜蘭達!
我知道我沒有回答你的問題,但是,爲什麼你要使用fancybox? Durandal具有顯示模式對話框的功能,甚至包含顯示如何更改方面的文檔(http://durandaljs.com/documentation/Showing-Message-Boxes-And-Modals/),你需要什麼從fancybox,可以杜倫達爾會做什麼? – 2013-03-21 13:08:02