-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
51 lines (46 loc) · 1.88 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
<title>ko implement</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<style>
.input-red {
}
</style>
</head>
<body>
<div id="test1" data-bind="template:peopleTemplate"></div>
<div>
You've clicked <span id="span1" data-bind="text:numberOfClicks"></span> times
<button id="button1" data-bind="click:incrementClickCounter">Click me</button>
</div>
<input id="ck1" type='checkbox' data-bind="enable:hasCellphone" />
<input id="ck2" type='checkbox' data-bind="visible:hasCellphone" />
<input id="ck3" data-bind="css:{input-red:hasCellphone}" />
<script src="namespace.js"></script>
<script src="utils.js"></script>
<script src="subscribable/subscrible.js" id="xxx"><h1>pppp</h1></script>
<script src="subscribable/observable.js"></script>
<script src="subscribable/dependecyDetection.js"></script>
<script src="subscribable/dependentObservable.js"></script>
<script src="subscribable/observableArray.js"></script>
<script src="bindings/defaultBinding.js"></script>
<script src="bindings/bindingAttributeSyntax.js"></script>
<script>
var viewModel = {
numberOfClicks : ko.observable(0),
incrementClickCounter : function() {
var previousCount = this.numberOfClicks();
this.numberOfClicks(previousCount + 1);
},
hasCellphone : ko.observable(false)
};
ko.applyBindingsToNode(viewModel, document.getElementById('span1'));
ko.applyBindingsToNode(viewModel, document.getElementById('button1'));
ko.applyBindingsToNode(viewModel, document.getElementById('ck1'));
ko.applyBindingsToNode(viewModel, document.getElementById('ck2'));
ko.applyBindingsToNode(viewModel, document.getElementById('ck3'));
</script>
</body>
</html>