In addition to being able to retrieve a path from a Falcor Model, you can also retrieve multiple Path Sets. Path Sets are paths that contain ranges or multiple string keys inside of indexers. In addition to being able to retrieve a Path Set, you can also retrieve as many paths as you like in a single method call.

You can fetch range of data:

model.get('people[0..1].titles[0].name')

Because what you fetch is not just a single a value, you need to use:

model.get()

Which return you a json string.

SO for example:

<!-- index.html -->
<html>
<head>
<!-- Do _not_ rely on this URL in production. Use only during development. -->
<script src="//netflix.github.io/falcor/build/falcor.browser.js"></script>
<script>
var model = new falcor.Model({
cache: {
people: [
{
name: "ZT",
titles: [
{
id: 123,
name: "Senior Frontend developer",
rating: 10
}
]
},
{
name: "WO",
titles: [
{
id: 321,
name: "Senior Software Engineer",
rating: 10
}
]
}
]
}
}); model.get('people[0..1].titles[0].name')
.then(function (json){
console.log(JSON.stringify(json, null, 2));
});
</script>
</head>
<body>
</body>
</html>

And what you will get:

{
"json": {
"people": {
"0": {
"titles": {
"0": {
"name": "Senior Frontend developer"
}
}
},
"1": {
"titles": {
"0": {
"name": "Senior Software Engineer"
}
}
}
}
}
}

You can pass multi enter points:

model.get('people[0..1].titles[0].name', 'people[0..1].titles[0].rating')

So you will get :

{
"json": {
"people": {
"0": {
"titles": {
"0": {
"name": "Senior Frontend developer",
"rating": 10
}
}
},
"1": {
"titles": {
"0": {
"name": "Senior Software Engineer",
"rating": 8
}
}
}
}
}
}

Notice that:

        model.get('people[0..1].titles[0].name',
'people[0..1].titles[0].rating')

The entor points we pass in are quite simialr, actually we can group them:

model.get('people[0..1].titles[0]["name", "rating"]')

You will still get the same result.

[Falcor] Retrieving Multiple Values的更多相关文章

  1. [Go] Returning Multiple Values from a Function in Go

    Returning multiple values from a function is a common idiom in Go, most often used for returning val ...

  2. python报错 TypeError: a() got multiple values for argument 'name'

    [问题现象] 在一次调用修饰函数中出现了问题,折腾了一下午,一直报错 TypeError:  got multiple values for argument 只是很简单的调用 from tsu2Ru ...

  3. Coroutines in Android - One Shot and Multiple Values

    Coroutines in Android - One Shot and Multiple Values 在Android中, 我们用到的数据有可能是一次性的, 也有可能是需要多个值的. 本文介绍An ...

  4. reverse/inverse a mapping but with multiple values for each key

    reverse/inverse a mapping but with multiple values for each key multi mappping dictionary , reverse/ ...

  5. 跨域:The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed

    https://blog.csdn.net/q646926099/article/details/79082204 使用Ajax跨域请求资源,Nginx作为代理,出现:The 'Access-Cont ...

  6. 跨域The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.解决方案

    使用Ajax跨域请求资源,Nginx作为代理,出现:The 'Access-Control-Allow-Origin' header contains multiple values '*, *', ...

  7. 【问题解决】'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.

    问题复述 今天项目组有人找我说之前部署的程序在测试环境没问题,到生产环境出现了奇怪的问题,点按钮没反应. 我通过腾讯会议发现他们的浏览器控制台上打出了如下错误: Access to XMLHttpRe ...

  8. TypeError: test() got multiple values for keyword argument 'key'

    原因是: 1.函数调用的最终形式只会调用两个函数.一个list参数和一个dict参数,格式为call(func, list, dict); 2.如果传入参数中有key参数,那么首先key参数(包括扩展 ...

  9. Python TypeError: __init__() got multiple values for argument 'master'(转)

    转自:https://stackoverflow.com/questions/33153404/python-typeerror-init-got-multiple-values-for-argume ...

随机推荐

  1. jquery val() and text().

    .val() works on input elements (or any element with a value attribute?) and .text() will not work on ...

  2. cursor 与refcursor及sys_refcursor的区别 (转载)

    楼主标明是转载的,我只把我转载的地址发上来 http://www.cnblogs.com/honliv/archive/2011/07/21/2112639.html 显式是相对与隐式cursor而言 ...

  3. Scene is unreachable due to lack of entry points and does not have an identifier for runtime access

    使用Storyboard时出现以下警告: warning: Unsupported Configuration: Scene is unreachable due to lack of entry p ...

  4. 查看sql server数据库各表占用空间大小

    exec sp_MSForEachTable @precommand=N' create table ##(id int identity,表名 sysname,字段数 int,记录数 int,保留空 ...

  5. 14_RHEL7安装mplayer

    这里用nux-dextop仓库来配置 Nux Dextop桌面对CentOS和RHEL 6/7可用.它是一个面对CentOS.RHEL.ScientificLinux的含有许多流行的桌面和多媒体相关的 ...

  6. 面向对象设计模式之Interpreter解释器模式(行为型)

    动机:在软件构建过程中 ,如果某一特定领域的问题比较复杂,类似的模式不断重复出现,如果使用普通的编程方式来实现将面临非常频繁的变化.在这种情况下,将特定领域的问题表达为某种语法规则的句子,然后构建一个 ...

  7. Html5 Canvas学习

    canvas: 首先在html页面中加入canvas标签 <canvas id="canvas" width="1024" height="74 ...

  8. 文成小盆友python-num7 -常用模块补充 ,python 牛逼的面相对象

    本篇内容: 常用模块的补充 python面相对象 一.常用模块补充 1.configparser模块 configparser 用于处理特定格式的文件,起内部是调用open()来实现的,他的使用场景是 ...

  9. 在sublimetext上打造一个兼容virtualenv的web&python开发环境

    利用Sublimetext3&virtualenv 打造一个Web&Python IDE 注: 环境:window|python3;以下使用的sublimetext插件均用packag ...

  10. JQuery调用iframe父页面元素与方法

    JQuery操作iframe父页面与子页面的元素与方法 下面简单使用Jquery来操作iframe的一些记录,这个使用纯JS也可以实现. 第一.在iframe中查找父页面元素的方法: $('#id', ...