-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathdemo.html
31 lines (30 loc) · 1.12 KB
/
demo.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
<!DOCTYPE html>
<html>
<head>
<title>Demo of Usage</title>
<script type="text/javascript" src="bin/uritemplate.js"></script>
</head>
<body>
<div id="id"></div>
<script type="text/javascript">
(function () {
"use strict";
var
templateText = "{?query*}",
variables = {
query: {
first: "1",
second: 2
}
},
expanded = UriTemplate.parse(templateText).expand(variables);
document.getElementById('id').innerHTML =
"<p>When you have a template of the form</p><p><code>var templateText = \"" + templateText
+ "\";</code></p><p>and params of the form </p><p><code>var variables = {query: {first: \"1\", second: 2}}"
+ ";</code></p><p>, you can use </p><p><code>UriTemplate.parse(templateText).expand(variables); </code></p><p>to produce </p><p><code>"
+ expanded
+ "</code></p><p> Look at the source code of this page!</p>";
}());
</script>
</body>
</html>