bug fix #369 - status property on angularjs response object

This commit is contained in:
Diullei Gomes
2013-03-06 22:47:53 -03:00
parent d805ae4f88
commit aed0b8aecd
2 changed files with 122 additions and 33 deletions

View File

@@ -45,16 +45,16 @@ module ng {
isString(value: any): bool;
isUndefined(value: any): bool;
lowercase(str: string): string;
/** construct your angular application
/** construct your angular application
official docs: Interface for configuring angular modules.
see: http://docs.angularjs.org/api/angular.Module
*/
module(
/** name of your module you want to create */
name: string,
/** name of modules yours depends on */
requires?: string[],
configFunction?: Function): IModule;
/** name of your module you want to create */
name: string,
/** name of modules yours depends on */
requires?: string[],
configFunction?: Function): IModule;
noop(...args: any[]): void;
toJson(obj: any, pretty?: bool): string;
uppercase(str: string): string;
@@ -72,11 +72,11 @@ module ng {
// see http://docs.angularjs.org/api/angular.Module
///////////////////////////////////////////////////////////////////////////
interface IModule {
/** configure existing services.
/** configure existing services.
Use this method to register work which needs to be performed on module loading
*/
config(configFn: Function): IModule;
/** configure existing services.
config(configFn: Function): IModule;
/** configure existing services.
Use this method to register work which needs to be performed on module loading
*/
config(inlineAnnotadedFunction: any[]): IModule;
@@ -84,17 +84,17 @@ module ng {
controller(name: string, controllerConstructor: Function): IModule;
controller(name: string, inlineAnnotadedConstructor: any[]): IModule;
directive(name: string, directiveFactory: Function): IModule;
directive(name: string, inlineAnnotadedFunction: any[]): IModule;
directive(name: string, inlineAnnotadedFunction: any[]): IModule;
factory(name: string, serviceFactoryFunction: Function): IModule;
factory(name: string, inlineAnnotadedFunction: any[]): IModule;
factory(name: string, inlineAnnotadedFunction: any[]): IModule;
filter(name: string, filterFactoryFunction: Function): IModule;
filter(name: string, inlineAnnotadedFunction: any[]): IModule;
filter(name: string, inlineAnnotadedFunction: any[]): IModule;
provider(name: string, serviceProviderConstructor: Function): IModule;
provider(name: string, inlineAnnotadedConstructor: any[]): IModule;
run(initializationFunction: Function): IModule;
run(inlineAnnotadedFunction: any[]): IModule;
run(inlineAnnotadedFunction: any[]): IModule;
service(name: string, serviceConstructor: Function): IModule;
service(name: string, inlineAnnotadedConstructor: any[]): IModule;
service(name: string, inlineAnnotadedConstructor: any[]): IModule;
value(name: string, value: any): IModule;
// Properties
@@ -139,14 +139,14 @@ module ng {
// XXX Same as avove
$modelValue: any;
$parsers: IModelParser[];
$formatters: IModelFormatter[];
$error: any;
$pristine: bool;
$dirty: bool;
$valid: bool;
$invalid: bool;
$invalid: bool;
}
interface IModelParser {
@@ -165,12 +165,12 @@ module ng {
// Documentation says exp is optional, but actual implementaton counts on it
$apply(exp: string): any;
$apply(exp: (scope: IScope) => any): any;
$broadcast(name: string, ...args: any[]): IAngularEvent;
$destroy(): void;
$digest(): void;
$emit(name: string, ...args: any[]): IAngularEvent;
// Documentation says exp is optional, but actual implementaton counts on it
$eval(expression: string): any;
$eval(expression: (scope: IScope) => any): any;
@@ -183,25 +183,25 @@ module ng {
$new(isolate?: bool): IScope;
$on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function;
$watch(watchExpression: string, listener?: string, objectEquality?: bool): Function;
$watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function;
$watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: bool): Function;
$watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function;
$id: number;
}
interface IAngularEvent {
targetScope: IScope;
currentScope: IScope;
name: string;
name: string;
preventDefault: Function;
defaultPrevented: bool;
// Available only events that were $emit-ted
stopPropagation?: Function;
}
}
///////////////////////////////////////////////////////////////////////////
// WindowService
@@ -385,8 +385,15 @@ module ng {
when(value: any): IPromise;
}
interface PromiseCallbackArg {
data?: any;
status?: number;
headers?: (headerName: string) => string;
config?: IRequestConfig;
}
interface IPromise {
then(successCallback: Function, errorCallback?: Function): IPromise;
then(successCallback: (response: PromiseCallbackArg) => any, errorCallback?: (response: PromiseCallbackArg) => any): IPromise;
}
interface IDeferred {
@@ -420,7 +427,7 @@ module ng {
// Methods bellow are not documented
info(): any;
get(cacheId: string): ICacheObject;
get (cacheId: string): ICacheObject;
}
interface ICacheObject {
@@ -432,7 +439,7 @@ module ng {
//capacity: number;
};
put(key: string, value?: any): void;
get(key: string): any;
get (key: string): any;
remove(key: string): void;
removeAll(): void;
destroy(): void;
@@ -484,8 +491,8 @@ module ng {
interface IHttpService {
// At least moethod and url must be provided...
(config: IRequestConfig): IHttpPromise;
get(url: string, RequestConfig?: any): IHttpPromise;
delete(url: string, RequestConfig?: any): IHttpPromise;
get (url: string, RequestConfig?: any): IHttpPromise;
delete (url: string, RequestConfig?: any): IHttpPromise;
head(url: string, RequestConfig?: any): IHttpPromise;
jsonp(url: string, RequestConfig?: any): IHttpPromise;
post(url: string, data: any, RequestConfig?: any): IHttpPromise;
@@ -503,10 +510,10 @@ module ng {
method: string;
url: string;
params?: any;
// XXX it has it's own structure... perhaps we should define it in the future
headers?: any;
cache?: any;
timeout?: number;
withCredentials?: bool;
@@ -522,7 +529,7 @@ module ng {
error(callback: (data: any, status: number, headers: (headerName: string) => string, config: IRequestConfig) => any): IHttpPromise;
}
interface IHttpProvider extends IServiceProvider {
interface IHttpProvider extends IServiceProvider {
defaults: IRequestConfig;
responseInterceptors: any[];
}
@@ -589,7 +596,7 @@ module ng {
// May not always be available. For instance, current will not be available
// to a controller that was not initialized as a result of a route maching.
current?: ICurrentRoute;
}
}
// see http://docs.angularjs.org/api/ng.$routeProvider#when for options explanations
interface IRoute {
@@ -626,7 +633,7 @@ module ng {
interface IInjectorService {
annotate(fn: Function): string[];
annotate(inlineAnnotadedFunction: any[]): string[];
get(name: string): any;
get (name: string): any;
instantiate(typeConstructor: Function, locals?: any): any;
invoke(func: Function, context?: any, locals?: any): any;
}
@@ -651,4 +658,4 @@ module ng {
}
}
}