Merge pull request #4509 from Bogh/master

AngularJS IResourceServiceProvider and IActionDescriptor url parameter
This commit is contained in:
Masahiro Wakame
2015-06-14 16:46:25 +09:00
4 changed files with 23 additions and 1 deletions
+9 -1
View File
@@ -8,6 +8,7 @@ interface IMyResourceClass extends angular.resource.IResourceClass<IMyResource>
///////////////////////////////////////
var actionDescriptor: angular.resource.IActionDescriptor;
actionDescriptor.url = '/api/test-url/'
actionDescriptor.headers = { header: 'value' };
actionDescriptor.isArray = true;
actionDescriptor.method = 'method action';
@@ -135,4 +136,11 @@ mod = mod.factory('factory name', resourceServiceFactoryFunction);
///////////////////////////////////////
// IResource
///////////////////////////////////////
///////////////////////////////////////
///////////////////////////////////////
// IResourceServiceProvider
///////////////////////////////////////
var resourceServiceProvider: angular.resource.IResourceServiceProvider;
resourceServiceProvider.defaults.stripTrailingSlashes = false;
+9
View File
@@ -21,6 +21,7 @@ declare module angular.resource {
stripTrailingSlashes?: boolean;
}
///////////////////////////////////////////////////////////////////////////
// ResourceService
// see http://docs.angularjs.org/api/ngResource.$resource
@@ -45,6 +46,7 @@ declare module angular.resource {
// Just a reference to facilitate describing new actions
interface IActionDescriptor {
url?: string;
method: string;
isArray?: boolean;
params?: any;
@@ -143,6 +145,13 @@ declare module angular.resource {
($resource: angular.resource.IResourceService): IResourceClass<T>;
<U extends IResourceClass<T>>($resource: angular.resource.IResourceService): U;
}
// IResourceServiceProvider used to configure global settings
interface IResourceServiceProvider extends ng.IServiceProvider {
defaults: IResourceOptions;
}
}
/** extensions to base ng based on using angular-resource */
+4
View File
@@ -34,3 +34,7 @@ $routeProvider
})
.otherwise({ redirectTo: '/' })
.otherwise({ redirectTo: ($routeParams?: ng.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) => "" });
var current: ng.route.ICurrentRoute;
current.locals['test-key'] = 'test-value';
+1
View File
@@ -109,6 +109,7 @@ declare module angular.route {
// see http://docs.angularjs.org/api/ng.$route#current
interface ICurrentRoute extends IRoute {
locals: {
[index: string]: any;
$scope: IScope;
$template: string;
};