开发者

How do I use knockoutjs with ScriptSharp?

As I have just learnt the Script# that I don't know how to use knockoutjs with ScriptSharp. I tried to read through the KnockoutAPI but I am still confused how to write even just a view Model containing just开发者_StackOverflow中文版 few knockout Observables and how to use the basic function like GetValue and SetValue.

Thanks for your attention.


You can do something like this:

public class MyViewModel {

    public Observable<string> firstName = Knockout.Observable<string>("Bob");
}

public static class App {

    static App() {
        MyViewModel vm = new MyViewModel();
        Knockout.ApplyBindings(vm);
    }
}

Hope that gets you started.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜