Description

Twigkit factory for getting and setting the location (url).

Methods

addFilterObjectToUrl(filter, reloadSearch)

Method to add a filter to the url
Parameters
ParamTypeDetails
filterObjectThe filter object to add to the url.
reloadSearch (optional)booleanWhether to reload search results.

Example

$lightningUrl.addFilterObjectToUrl(filter);

addFilterToLocationCopy(fieldName, actual, display, orFilter, location, exclude, match)

Method to add a filter to the url
Parameters
ParamTypeDetails
fieldNamestringThe name of the filter to apply.
actualstringThe actual value of the filter.
displaystringThe display value of the filter.
orFilter (optional)stringIf the filter is to be ORed.
locationobjectThe location object to use, this should be angular.copy’d before
exclude (optional)booleanIf the filter is to be exclude values
match (optional)string’left_partial’ or ‘partial’ or ‘right_partial’ or ‘exact’

Example

$lightningUrl.addFilterToUrl(addFilterToLocationCopy, actual, display, orFilter, location);

addFilterToUrl(fieldName, actual, display, reloadSearch, orFilter, exclude, match)

Method to add a filter to the url
Parameters
ParamTypeDetails
fieldNamestringThe name of the filter to apply.
actualstringThe actual value of the filter.
displaystringThe display value of the filter.
reloadSearch (optional)booleanWhether to reload search results.
orFilter (optional)stringIf the filter is to be ORed
exclude (optional)booleanIf the filter is to be exclude values
match (optional)string’left_partial’ or ‘partial’ or ‘right_partial’ or ‘exact’

Example

$lightningUrl.addFilterToUrl(filterName, actual, display, reloadSearch);

addRangeFilterDisplayToUrl(fieldName, from, to, displayFrom, displayTo, reloadSearch, orFilter, fromExcluded, toExcluded, exclude)

Method to add a filter to the url
Parameters
ParamTypeDetails
fieldNamestringThe name of the filter to apply.
fromstringThe from value of the filter.
tostringThe to value of the filter.
displayFromstringThe from display value of the filter.
displayTostringThe to display value of the filter.
reloadSearch (optional)booleanWhether to reload search results.
orFilter (optional)booleanIf the filter is to be ORed
fromExcluded (optional)stringwhether the from is to be excluded.
toExcluded (optional)stringWhether the to is to be excluded.
exclude (optional)booleanWhether the values should be excluded.

Example

$lightningUrl.addRangeFilterDisplayToUrl(fieldName, from, to, display, reloadSearch, orFilter, fromExcluded, toExcluded) ;

addRangeFilterToUrl(fieldName, from, to, displayFrom, displayTo, reloadSearch, orFilter, toLabel, fromExcluded, toExcluded, exclude)

Method to add a filter to the url
Parameters
ParamTypeDetails
fieldNamestringThe name of the filter to apply.
fromstringThe from value of the filter.
tostringThe to value of the filter.
displayFromstringThe from display value of the filter.
displayTostringThe to display value of the filter.
reloadSearch (optional)booleanWhether to reload search results.
orFilter (optional)booleanIf the filter is to be ORed
toLabel (optional)stringThe label which appears between the from and to values.
fromExcluded (optional)stringwhether the from is to be excluded.
toExcluded (optional)stringWhether the to is to be excluded.
exclude (optional)booleanWhether the values should be excluded.

Example

$lightningUrl.addRangeFilterToUrl(fieldName, from, to, displayFrom, displayTo, reloadSearch, orFilter, toLabel, fromExcluded, toExcluded);

createFilter(fieldName, actual, display, orFilter, exclude, match, type)

Creates a filter for the URL
Parameters
ParamTypeDetails
fieldNamestringThe name of the filter to apply.
actualstringThe actual value of the filter.
displaystringThe display value of the filter.
orFilter (optional)stringIf the filter is to be ORed (field or value)
exclude (optional)booleanIf the filter is to be exclude values
match (optional)string’left_partial’ or ‘partial’ or ‘right_partial’ or ‘exact’
type (optional)stringExplicitly set the type of the filter, ‘string’ or ‘number’. A string filter value will be wrapped in double quotes.
Returns
stringReturns a filter that can be added to the URL

createFilterFromObject(filter)

Creates a filter for the URL
Parameters
ParamTypeDetails
filterObjectThe filter object or string to create a filter from.
Returns
stringReturns a filter that can be added to the URL

createRangeFilter(fieldName, from, to, displayFrom, displayTo, orFilter, toLabel, fromExcluded, toExcluded, exclude)

Creates a range filter for the URL
Parameters
ParamTypeDetails
fieldNamestringThe name of the filter to apply.
fromstringThe from value of the filter.
tostringThe to value of the filter.
displayFromstringThe from display value of the filter.
displayTostringThe to display value of the filter.
orFilter (optional)stringIf the filter is to be ORed (value | field)
toLabel (optional)stringThe label which appears between the from and to values.
fromExcluded (optional)stringwhether the from is to be excluded.
toExcluded (optional)stringWhether the to is to be excluded.
exclude (optional)booleanWhether the values should be excluded.
Returns
stringReturns a filter that can be added to the URL

createRangeFilterDisplay(filterName, from, to, display, orFilter, fromExcluded, toExcluded, exclude)

Creates a range filter for the URL
Parameters
ParamTypeDetails
filterNamestringThe name of the filter to apply.
fromstringThe from value of the filter.
tostringThe to value of the filter.
displaystringThe display value of the filter.
orFilter (optional)stringIf the filter is to be ORed (value | field)
fromExcluded (optional)stringwhether the from is to be excluded.
toExcluded (optional)stringWhether the to is to be excluded.
exclude (optional)booleanWhether the values should be excluded.
Returns
stringReturns a filter that can be added to the URL

getAllUrlParameters()

Method to get a copy of all URL parameters
Returns
objectObject literal of all URL parameters

Example

$lightningUrl.getAllUrlParameters();

getFiltersFromUrl(fieldName)

Method to gets all of a set of filters from the url
Parameters
ParamTypeDetails
fieldNamestringOnly get filters on the specified field.
Returns
ArrayReturns values of the filterName from URL.

Example

$lightningUrl.getFiltersFromUrl(filterName);

getUrlParameter(parameter, defaultValue)

Method to get a url parameter
Parameters
ParamTypeDetails
parameterstringThe parameter to get from the URL.
defaultValue (optional)stringThe value to return if parameter returns null.
Returns
varReturns value of parameter from URL or defaultValue.

Example

$lightningUrl.getUrlParameter(parameter, defaultValue);

getUrlParametersAsArray(parameter, defaultValue)

Method to gets an array of url parameters
Parameters
ParamTypeDetails
parameterstringThe parameter to get from the URL.
defaultValue (optional)stringThe value to return if parameter returns null.
Returns
ArrayReturns values of the parameter from URL or defaultValue in an array.

Example

$lightningUrl.getUrlParametersAsArray(parameter, defaultValue);

removeFiltersFromUrl(filterName, reloadSearch)

Method to remove all of a set of filters from the url
Parameters
ParamTypeDetails
filterNamestringThe name of the filter to remove.
reloadSearch (optional)booleanWhether to reload search results.

Example

$lightningUrl.removeFiltersFromUrl(filterName, reloadSearch);

removeFiltersFromUrl(filterName, reloadSearch)

Method to remove all of a set of filters from the url
Parameters
ParamTypeDetails
filterNamestringThe name of the filter to remove.
reloadSearch (optional)booleanWhether to reload search results.

Example

$lightningUrl.removeFiltersFromUrl(filterName, reloadSearch);

resetAllParameters(reloadSearch)

Resets all URL Parameters
Parameters
ParamTypeDetails
reloadSearchbooleanWhether to reload the search

resetParameters(parameters, reloadSearch)

Resets a selection of parameter types
Parameters
ParamTypeDetails
parametersarraytypes to reset
reloadSearchbooleanWhether to reload the search

setUrlParameter(parameter, value, reloadSearch)

Method to set a url parameter
Parameters
ParamTypeDetails
parameterstringThe parameter to add to the URL.
valueArraystringThe value to assign to the parameter.
reloadSearch (optional)booleanWhether to reload the results.

Example

$lightningUrl.setUrlParameter(parameter, value, reloadSearch);

setUrlParameters(query, reloadSearch)

Method to set a group of url parameters from a query.
Parameters
ParamTypeDetails
queryObjectQuery object from which URL Parameters are to be used.
reloadSearch (optional)booleanWhether to reload the search once all the parameters have been set.

Example

$lightningUrl.setUrlParameters(query);

urlContainsFilter(filterName, actual, display, orFilter, exclude, match)

Method to set if filter is in the url
Parameters
ParamTypeDetails
filterNamestringThe name of the filter to apply.
actualstringThe actual value of the filter.
displaystringThe display value of the filter.
orFilter (optional)stringIf the filter is to be ORed on value or field
exclude (optional)booleanIf the filter is to be exclude values
match (optional)string’left_partial’ or ‘partial’ or ‘right_partial’ or ‘exact’
Returns
booleanWhether the URL contains the filter.

urlContainsFilterFromObject(filter)

Method to see if filter is in the url
Parameters
ParamTypeDetails
filterobjectThe filter object
Returns
booleanWhether the URL contains the filter.