Class: Location service:ngeoLocation

ngeo.statemanager.Location

new Location(location, history)

Provides a service for interacting with the URL in the browser address bar.

WARNING: because of a bug in Angular this service is not compatible with the $location service. This further means that service is not compatible with the $anchorScroll and $route services, and with the ng-include and ng-view directives (which are based on the $anchorScroll and $route services). See .

This file also provides an ngeo.statemanager.Location.MockProvider function that you can use to mock Angular's $location provider and make it possible to use both ngeoLocation and ng-include.

app.module.config(ngeo.statemanager.Location.MockProvider);

The ngeo Location type.

See our live example: ../examples/permalink.html

Parameters:
Name Type Description
location Location

Location.

history History

History.

Members

(static, non-null) module: angular.Module

FIXME add utils dependencies.FIXME What about Mockup provider ?

Methods

(static) LocationFactory($rootScope, $window)

The factory creating the ngeo Location service.

Parameters:
Name Type Description
$rootScope angular.Scope

The root scope.

$window angular.$window

Angular window service.

Returns:
ngeo.statemanager.Location

The ngeo location service.

(static) MockProvider($locationProvider)

A function that changes Angular's $location provider to avoid problem when both ngeoLocation and $location are used in an application. This is how you can use that function in an application:

app.module.config(ngeo.statemanager.Location.MockProvider);

Parameters:
Name Type Description
$locationProvider angular.$locationProvider

Angular location provider.

(static) replaceState(history, state)

Parameters:
Name Type Description
history History

History.

state string

State.

deleteFragmentParam(key)

Delete a param int the fragment of the location's URI.

Parameters:
Name Type Description
key string

Param key.

deleteParam(key)

Delete a param in the location's URI.

Parameters:
Name Type Description
key string

Param key.

getFragmentParam(key)

Get a param from the fragment of the location's URI.

Parameters:
Name Type Description
key string

Param key.

Returns:
string|undefined

Param value.

getFragmentParamAsInt(key)

Get a param from the fragment of the location's URI as integer. If the entry does not exist, or if the value can not be parsed as integer, undefined is returned.

Parameters:
Name Type Description
key string

Param key.

Returns:
number|undefined

Param value.

getFragmentParamKeys()

Get an array with all existing param's keys from the fragment of the location's URI.

Returns:
Array.

Param keys.

getFragmentParamKeysWithPrefix(prefix)

Get an array with all existing param's keys from the fragment of the location's URI that start with the given prefix.

Parameters:
Name Type Description
prefix string

Key prefix.

Returns:
Array.

Param keys.

getParam(key)

Get a param in the location's URI.

Parameters:
Name Type Description
key string

Param key.

Returns:
string|undefined

Param value.

getParamAsFloat(key)

Get a param in the location's URI as a floating point number. If the entry does not exist, or if the value can not be parsed, undefined is returned.

Parameters:
Name Type Description
key string

Param key.

Returns:
number|undefined

Param value.

getParamAsInt(key)

Get a param in the location's URI as integer. If the entry does not exist, or if the value can not be parsed as integer, undefined is returned.

Parameters:
Name Type Description
key string

Param key.

Returns:
number|undefined

Param value.

getParamKeys()

Get an array with all existing param's keys in the location's URI.

Returns:
Array.

Param keys.

getParamKeysWithPrefix(prefix)

Get an array with all existing param's keys in the location's URI that start with the given prefix.

Parameters:
Name Type Description
prefix string

Key prefix.

Returns:
Array.

Param keys.

getPath()

Get the location's current path.

Returns:
string|undefined

The path.

getUriString()

Get the location's URI as a string

Returns:
string

The URI.

hasFragmentParam(key)

Check if a param exists in the fragment of the location's URI.

Parameters:
Name Type Description
key string

Param key.

Returns:
boolean

True if the param exists.

hasParam(key)

Check if a param exists in the location's URI.

Parameters:
Name Type Description
key string

Param key.

Returns:
boolean

True if the param exists.

refresh()

Refresh the the location's URI.

setPath(path)

Set a new path for this location.

Parameters:
Name Type Description
path string

Path.

updateFragmentParams(params)

Set or create a param in the fragment of the location's URI.

Parameters:
Name Type Description
params !Object.

Parameters.

updateParams(params)

Set or create a param in the location's URI.

Parameters:
Name Type Description
params !Object.

Parameters.