[Falcor] Building Paths Programmatically
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.