1
我有一個工具欄對象在我的視圖模型和它得到渲染陣列打字稿文本對象:包含對象
var toolbar = {
items: [
{
location: 'before',
template: 'nav-button'
},
{
location: "before",
html: ko.observable(showCurrentDateTime()),
tabIndex: 1
},
{
location: "center",
text: "title",
},
{
location: "after",
html: "<img src='../images/logo.png'>"
}
]
};
然而,VS2013給了我一個奇怪的錯誤,當我嘗試設置的一個內容目標項如下:
toolbar.items[1].html(showCurrentDateTime());
error: The property 'html' does not exist on value of type '{}'
我該如何正確聲明/ initalise工具欄?
在此先感謝