1
型號的所有產品定義模型刪除使用Emberjs
App.Store = DS.Store.extend({
revision: 12,
adapter: DS.FixtureAdapter
});
App.Markets = DS.Model.extend({
name: DS.attr("string"),
created: DS.attr("string")
});
App.Markets.FIXTURES = [
{id:1, name:"name1", created:'2013-1-1'},
{id:2, name:"name2", created:'2013-1-2'},
{id:3, name:"name3", created:'2013-1-3'}
];
定義控制器
App.MarketsController = Ember.ArrayController.extend({
changeMarkets:function(marketer_id){
// remove all item of App.Markets Model
//-------
// add new item in App.Markets Model
App.Sources.createRecord({
id: 100,
name: "new name1",
created: "2014-2-1"
});
App.Sources.createRecord({
id: 200,
name: "new name2",
created: "2014-2-2"
});
App.Sources.createRecord({
id: 300,
name: "new name3",
created: "2014-2-3"
});
}
});
我要刪除所有紡織機械展覽會,並添加一些使用一個在emberjs功能changeMarkets模型對象。 我想知道如何刪除模型的所有內容。