Tightened up the ILocationService typings a little

This commit is contained in:
John Reilly
2014-08-22 17:07:11 +01:00
parent 639aa3c14d
commit 17b7b270f5
2 changed files with 105 additions and 10 deletions
+55 -9
View File
@@ -557,25 +557,71 @@ declare module ng {
assign(context: any, value: any): any;
}
///////////////////////////////////////////////////////////////////////////
// LocationService
// see http://docs.angularjs.org/api/ng.$location
// see http://docs.angularjs.org/api/ng.$locationProvider
// see http://docs.angularjs.org/guide/dev_guide.services.$location
///////////////////////////////////////////////////////////////////////////
/**
* $location - $locationProvider - service in module ng
* see https://docs.angularjs.org/api/ng/service/$location
*/
interface ILocationService {
absUrl(): string;
hash(): string;
hash(newHash: string): ILocationService;
host(): string;
/**
* Return path of current url
*/
path(): string;
path(newPath: string): ILocationService;
/**
* Change path when called with parameter and return $location.
* Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing.
*
* @param path New path
*/
path(path: string): ILocationService;
port(): number;
protocol(): string;
replace(): ILocationService;
/**
* Return search part (as object) of current url
*/
search(): any;
search(parametersMap: any): ILocationService;
search(parameter: string, parameterValue: any): ILocationService;
/**
* Change search part when called with parameter and return $location.
*
* @param search When called with a single argument the method acts as a setter, setting the search component of $location to the specified value.
*
* If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the url.
*/
search(search: any): ILocationService;
/**
* Change search part when called with parameter and return $location.
*
* @param search New search params
* @param paramValue If search is a string, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted.
*/
search(search: string, paramValue: string): ILocationService;
/**
* Change search part when called with parameter and return $location.
*
* @param search New search params
* @param paramValue If paramValue is an array, it will override the property of the search component of $location specified via the first argument.
*/
search(search: string, paramValue: string[]): ILocationService;
/**
* Change search part when called with parameter and return $location.
*
* @param search New search params
* @param paramValue If paramValue is true, the property specified via the first argument will be added with no value nor trailing equal sign.
*/
search(search: string, paramValue: boolean): ILocationService;
url(): string;
url(url: string): ILocationService;
}