內使用時如不方便綁定都不能正常工作我使用的是淘汰賽JSknockoutjs如果和模板
<tbody data-bind="foreach: List">
<tr>
<td><input type="button" data-bind="if: ($parent.IsFVL || $parent.AllowChat || $root.Me().AllowChatMonitoring), value: ID, click: SelectVisit" /><span data-bind="ifnot: ($parent.IsFVL || $parent.AllowChat || $root.Me().AllowChatMonitoring), text: ID"></span></td>...
下面的模板並調用/啓動模板這樣
<div data-bind="template: { name: 'tplVisitsGrid', data: { Title: 'My Visits', 'List': MVL, 'AllowChat': true, 'AllowPing': false, 'IsFVL': false } }"></div>
也我已經仔細檢查了「$ root.Me()。AllowChatMonitoring」的值是否爲true,但輸入[type = button]和span都呈現,有人可以幫我解決問題。
謝謝。
這些屬性是不可觀測的,所以你的建議將無法正常工作。 –
@ArtemVyshniakov對於他們在'If'綁定工作,他們*必須*可觀察 – xdumaine