How to call Knockout’s ko.applyBindings with an element that has been jQuery append the DOM ?

How to call Knockout’s ko.applyBindings with an element that has been jQuery append the DOM ?

<html>
<body>
    <div id='main'>
    </div>
</body>

The following code is

var viewModel = {
    choices: ["one", "two", "three"],
    selected: ko.observable()
};

// this HTML would be loaded from the server
var htmlWithBindings = '<div><b data-bind="text: selected"></b><select data-bind="options: choices, value: selected"></select></div>';

var jQueryObj = $(htmlWithBindings);

ko.applyBindings(viewModel, jQueryObj.get(0));

$('#main').append(jQueryObj);
廣告
張貼在 JavaScript, Knockout | 發表留言

CDN List

Microsoft CDN
http://www.asp.net/ajaxlibrary/CDN.ashx?NoRedirect=1#Knockout_Releases_on_the_CDN_10

jQuery CDN
http://codeorigin.jquery.com/

張貼在 電腦和網際網路 | 發表留言

Sublime Text 2 Packages

These packages did organize the XML and JSON format, so that the data presented are indented format.

Preferences –>Package Control –> Install Package –> Input “Pretty JSON”

CTRL + ALT + J

Preferences –>Package Control –> Install Package –> Input “indentxml”

CTRL + K + F

張貼在 電腦和網際網路 | 標記 , | 發表留言

SQL Server Management Studio addin–SQL Search

SQL Server Management Studio addin 有個好用外掛

http://www.red-gate.com/products/sql-development/sql-search/

這個工具可以搜尋符合你要的StoreProcedure/View/Table….

張貼在 TSQL | 發表留言

How to disable StyleCop Warning in the auto-generated code file

Simple, add the following the line
// <auto-generated />

張貼在 未分類 | 發表留言

Chrome crash problem

If you have chrome crash problem, you can input “about:conflicts” in the URL bar.

Check whether you have installed will cause Chrome to crash or malware the will not be excluded.

張貼在 電腦和網際網路 | 發表留言

ASP.NET WCF Error 404.17–Not Found

當你執行.NET 2.0 的 ASP.NET WCF 時候, 出現 WCF Error 404.17 Not Found 錯誤

1

這是因為不知名的安裝順序造成「.svc」只有 .NET 4.0 才能用的局面因此我們必須手動加上 .NET 2.0的相關設定。

打開IIS管理員, 點取”處理常式對應”

3

你可以發現svc-Integrated 都是.net 4.0設定

2

必須手動新增.net 2.0設定

    要求路徑:*.svc
    類型:System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    名稱:svc-Integrated

張貼在 WCF | 發表留言