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. photoshop mac版下载及破解

    1.下载 直接百度photoshop,就可以找到百度的下载源: 2.破解 http://zhidao.baidu.com/question/581955095.html

  2. xfire找不到services.xml

    java.io.FileNotFoundException: class path resource [META-INF/xfire/services.xml] cannot be opened be ...

  3. c#求slope线性回归斜率

    public class mySlope { // public List<double> Values { get; set; } public double SlopeResult { ...

  4. C++ 性能剖析 (四):Inheritance 对性能的影响

    (这个editor今天有毛病,把我的format全搞乱了,抱歉!) Inheritance 是OOP 的一个重要特征.虽然业界有许多同行不喜欢inheritance,但是正确地使用inheritanc ...

  5. seajs常用API整理

    本文来自于https://github.com/seajs/seajs/issues/266

  6. CSS hack技巧

    CSS hack技巧一览,原文来自CSDN freshlover的博客专栏<史上最全CSS Hack方式一览> 什么是CSS hack 由于不同厂商的流览器或某浏览器的不同版本(如IE6- ...

  7. twisted(1)--何为异步

    早就想写一篇文章,整体介绍python的2个异步库,twisted和tornado.我们在开发python的tcpserver时候,通常只会用3个库,twisted.tornado和gevent,其中 ...

  8. Python第三方库(模块)"scikit learn"以及其他库的安装

    scikit-learn是一个用于机器学习的 Python 模块. 其主页:http://scikit-learn.org/stable/. GitHub地址: https://github.com/ ...

  9. iphone升级ios7之后出现蓝框框一直跳的问题

    问题描述:iphone升级ios7之后出现蓝框框一直跳            解决办法:设置-通用-辅助功能-切换控制-里边打开了切换控制及自动扫描,直接关闭切换控制就好了

  10. springboot工程读取配置文件application.yml的写法

    现在流行springboot框架的项目,里面的默认配置文件为application.yml,我们怎样读取这个配置文件呢? 先贴上我得配置文件吧 目录结构 里面内容 1 写读取配置文件的工具类 @Con ...