码迷,mamicode.com
首页 > 其他好文 > 详细

[Falcor] Building Paths Programmatically

时间:2015-12-26 06:25:44      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:

        model.setValue(‘genreList[0].titles[0].rating‘, 5)
                .then(function (value) {
                    model.get(‘genreList[0..1].titles[0]["name","rating"]‘)
                            .then(function (json) {
                                console.log(JSON.stringify(json, null, 3));
                            })
                });

 

In the code, we use Javascript path (dot): genreList[0..1].titles[0]["name", "rating"]; 

 

We can also use array syntax:

["genreList", {from: 0, to: 1}, "titles", 0, ["name", "rating"]]

 

They achieve the same result, but using array syntax is more flexable:

var index =0;
["genreList", {from: index, to:index+ 1}, "titles", index, ["name", "rating"]]

Because you can ember the variable.

 

[Falcor] Building Paths Programmatically

标签:

原文地址:http://www.cnblogs.com/Answer1215/p/5077416.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!