首页 > 其他 > 详细

[Falcor] Building Paths Programmatically

时间:2015-12-26 06:25:04      阅读:258      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!