-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
43 lines (39 loc) · 902 Bytes
/
index.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
<!DOCTYPE html>
<html>
<head>
<title>Ractive with Object.observe</title>
<script src="vendor/Ractive.min.js" type="text/javascript"></script>
<script src="ractive-object-observe.js" type="text/javascript"></script>
</head>
<body>
<pre><code>
# Fire up dev tools and try:
superheroes[0].name = "Wagner, Kurt";
superheroes.push({ name: "Wolverine" });
superheroes.length = 0;
</code></pre>
<div id="app"></div>
<script id='superherosTemplate' type='text/ractive'>
<h1>Superheroes</h1>
<ul id="superheroes">
{{#superheroes}}
<li>{{name}}</li>
{{/superheroes}}
</ul>
</script>
<script>
window.superheroes = [
{name: "Nightcrawler" },
{name: "Cyclops" },
{name: "Rogue" }
];
var view = new Ractive({
el: 'app',
template: "#superherosTemplate",
data: {superheroes: superheroes},
modifyArrays: false,
adaptors: [ 'ObjectObserve' ]
});
</script>
</body>
</html>