Merge pull request #2477 from dsuket/master

fixed bug. change Collection.collection to Model.collection
This commit is contained in:
Basarat Ali Syed
2014-07-08 11:17:39 +10:00
2 changed files with 10 additions and 1 deletions
+8
View File
@@ -140,6 +140,14 @@ function test_collection() {
var alphabetical = books.sortBy((book: Book): number => {
return null;
});
var model: Book = new Book({title: "Test", author: "Mike"});
books.add(model);
var model2: Book = model.collection.first();
if (model !== model2) {
throw new Error("Error");
}
}
//////////
+2 -1
View File
@@ -95,6 +95,8 @@ declare module Backbone {
attributes: any;
changed: any[];
cid: string;
collection: Collection<any>;
/**
* Default attributes for the model. It can be an object hash or a method returning an object hash.
* For assigning an object hash, do it like this: this.defaults = <any>{ attribute: value, ... };
@@ -156,7 +158,6 @@ declare module Backbone {
//model: typeof TModel;
model: { new(): TModel; }; // workaround
models: TModel[];
collection: TModel;
length: number;
constructor(models?: TModel[], options?: any);