「実際のデータベース」を使用せずに、単純な backbone.js アプリを構築しています。私のデータベースは非常に単純で、次のようになります。
[
    { "Name": "Daniel", "Month": "abc", "year": "83" },
    { "Name": "Johan", "Month": "abg", "year": "33" }
]
データをコレクション インスタンスにフェッチすることに成功したので、console.log を実行して、それが機能することを確認しました。
this.nameList = new NameList();
this.nameList.fetch();
console.log(this.nameList); 
ここまでは問題ありませんが、コレクション内のモデルの 1 つだけを使用しようとしましたが、何も機能しません。私は試した:
console.log(this.nameList.at(1));
console.log(this.nameList.get(id));  //when id is passed as a number.
console.log(this.nameList.getByCid(id))  //when id is passed as a number.
私はいつも「未定義」になります。
- そのような単純なデータベースをどのように扱うことができますか?
- このことについてどこで読むことができますか?
更新として、コレクションを操作するときに機能します。
    this.projectList = new ProjectList;
    this.projectList.fetch({
        success: function (data) {
            console.log(data.get(id));
        }
    });
単一のモデルで作業しているときに機能しない:
    this.project = new Project({id: id});
    this.project.fetch({
        success: function (data) {
            console.log(data);
        }
    });
今私は得る: GET ......../Client/web/Data/projects/3 404 (見つかりません)
なんで?