Skip to content

Commit 771f9ab

Browse files
committed
Merge pull request DefinitelyTyped#7034 from Brooooooklyn/issue/angular-resource
fix(angularjs): add toJSON method
2 parents fe162ab + 0ab253f commit 771f9ab

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

angularjs/angular-resource-tests.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () {
8989

9090
var promise : angular.IPromise<IMyResource>;
9191
var arrayPromise : angular.IPromise<IMyResource[]>;
92+
var json: {
93+
[index: string]: any;
94+
};
9295

9396
promise = resource.$delete();
9497
promise = resource.$delete({ key: 'value' });
@@ -127,6 +130,8 @@ promise = resource.$save(function () { });
127130
promise = resource.$save(function () { }, function () { });
128131
promise = resource.$save({ key: 'value' }, function () { }, function () { });
129132

133+
json = resource.toJSON();
134+
130135
///////////////////////////////////////
131136
// IResourceService
132137
///////////////////////////////////////

angularjs/angular-resource.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ declare module angular.resource {
136136
/** the promise of the original server interaction that created this instance. **/
137137
$promise : angular.IPromise<T>;
138138
$resolved : boolean;
139+
toJSON: () => {
140+
[index: string]: any;
141+
}
139142
}
140143

141144
/**

0 commit comments

Comments
 (0)