How to create a ViewModel with Knockout.Js
This article focuses on "how to create a ViewModel with Knockout.Js". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to create a ViewModel with Knockout.Js.
Knockout.Js creates a ViewModel
/ / 1. Create a ViewModel
Var myViewModel = {
PersonName:'aehyok'
PersonAge:25
}
two。 Create a simple View for declarative binding for ViewModel
The name is
3. Activate Knockout
Ko.applyBindings (myViewModel)
At this point, I believe you have a deeper understanding of "how to create a ViewModel with Knockout.Js". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!