KnockoutJS is a common JS framework. It aims to reduce the complexity and difficulty in understanding the operation code caused by a large number of DOM operations when developers use JavaScript or JQuery, and facilitate the separation of data from HTML, the development efficiency can be improved on the premise that everyone in the team agrees with this framework.
I have recently started using this framework and have recorded General Usage experiences
Knockout. js tries to introduce Microsoft's verified mvvm solution to JS, so it is necessary to learn. Mvvm is designed for interface development to solve rich interactive frequency changes, which is very similar to web development. Production Manager and test supervisor, who can't understand the back-end things and can only point out what the front-end sees, so
Use asp.net mvc, bookers, and knockout. js to develop custom menu editing tools (recommended ),
Preface
You can edit the custom menu by using the interface debugging tool, but by submitting the menu for creating json-format data, it is very inconvenient and error-prone. The tool on the Internet is not easy to use, so I wrote one by myself.
Body
Use bootstrap to sort out the page framework. To call the custo
Add, remove, and modify bindings in Knockout JS.
Knockuot JS seems to have only considered how to bind (ko. applyBindings (), but has not considered how to remove the binding. When the DOM content is modified and needs to be re-bound, it seems powerless.
I. Solution
Here is a rebinding method, that is, use ko. cleanNode (
1. VIEW Model
2. VIEW-MOLDE
Ii. Probl
Knockout. js helps you build the UI in Model-View-viewmodel (mvvm) mode.
This article provides the implementation of scriptsharp based on the example provided by http://learn.knockoutjs.com.
For more information about scriptsharp Quick Start, see: http://www.cnblogs.com/laojia/archive/2011/09/29/2195611.html.
In this example, the scriptsharp Project template is jquery library. After the project is created,
Knockuot JS seems to have only considered how to bind (Ko.applybindings ()), but did not consider how to remove the binding, when the DOM content modified, the need to re-bind time, found that there seems to be powerless.First, the solutionHere's a way to rebind, using Ko.cleannode (1. View Model2, View-moldeSecond, the question1, but it is said that there may be problems, one of the problems is that the DOM-related event binding is not possible to re
() {
var span2 = document.getElementById ("span2");
Alert (Span2.getattribute (' data-bind '));
Span2.setattribute ("Data-bind", "" ");
Alert (Span2.getattribute (' data-bind '));
Ko.cleannode (SPAN2);
Ko.applybindings (MyModel, span2);
}
Script>
Description: This example refers to an example of a brother on the web, whose thinking is clear, but the example provided does not really solve the problem of multiple bindings, and thank the brother.Reference:1 Clear/remove obser
This section is another way to interpret it. It may be easier for everyone to understand the things I have digested. Knockout. js uses a lot of closures, which is very difficult to read.
We can see from viewmodel:
function MyViewModel() { this.firstName = $.observable('Planet'); this.lastName = $.observable('Earth'); this.fullName = $.computed({
What is a CDN public library?CDN Public Library refers to the common JS inventory placed in the CDN node, in order to facilitate the broad masses of developers directly call. Compared with the JS inventory on the server machine, the CDN
Requirements Description
Website www.xxx.com, Environment WIN64 WAMP, distribution 3 Too server, main 1 units, 3 units. The images used in the/css/js are placed in the www.xxx.com/Public/directory. Requirements are introduced in the site/public directory js/css will automatically compress, facilitate the opening speed.
Original plan
Through Jsminify + htaccess, the request address of the
[Urgent] How does one implement automatic css js compression in CDN?
Initial requirement
For high website concurrency, we need to compress images, CSS, and JS resources to save the bandwidth of server traffic resources.
Server Configuration: Master 1, three at a time. The primary Win64 + WAMP, which is automatically allocated to the domain name through DNS resol
Brief introductionIf your host is abroad, or at home but because the north-South interoperability problem open speed is not ideal, or the bandwidth itself is very small open speed is not fast, we need to do some other aspects of optimization to improve the speed of website access.What is a CDN public library?CDN Public Library refers to the common JS inventory pl
Initial Requirements
Site high concurrency, you need to use the image/css/js resources to compress, to conserve server traffic resource bandwidth.
Server configuration: Primary 1, secondary 3 units. The main win64+ WAMP, through DNS automatic resolution allocation point.
Solution Solutions
The master server joins the Google jsminify Library, overwriting all access to the Css/js file under the Resource
1.CdnjsHttps://cdnjs.com/librariesFork me on GitHubEveryone loves the Google CDN right? Even Microsoft runs their own CDN.The problem is, they only host the most popular libraries.We host It All-javascript, CSS, SWF, images, etc!Join us now on github!Supports Http/https/spdy, we encourage always using HTTPS!Currently used by ~722,000 websites worldwide.2.MicrosoftHttp://www.asp.net/ajax/cdn3.Googlehttps://developers.google.com/speed/libraries/The Goog
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.