Skip to content

Instantly share code, notes, and snippets.

@ChrisCates
Created September 25, 2015 04:11
Show Gist options
  • Save ChrisCates/326bc46236fc0720d7e0 to your computer and use it in GitHub Desktop.
Save ChrisCates/326bc46236fc0720d7e0 to your computer and use it in GitHub Desktop.
<!-- index.html -->
<html>
<head>
<!-- Do _not_ rely on this URL in production. Use only during development. -->
<script src="falcor.browser.js"></script>
<script>
$ref = falcor.Model.ref;
var json = {
"greeting": {
9001: "hello world"
},
"other_greetings": {
"two": {$type: "ref", value: "greeting"},
"three": $ref("greeting")
}
}
var model = new falcor.Model({
cache: json
});
// retrieve the "greeting" key from the root of the Virtual JSON resource
model.
get("other_greetings['two']").
then(function(response) {
console.log(response.json);
document.write(response.json.other_greetings.two);
});
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment