Created
September 25, 2015 04:11
-
-
Save ChrisCates/326bc46236fc0720d7e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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