PrefsService - Preferences Service
PrefsService is an Angular Factory in the Util module with the name prefs.js
. It provides an API to manage preferences using the $cookies service. To use these functions, see the documentation on injecting Angular services.
Name | Summary |
---|---|
getPrefs | Gets a cookie set with a specific name's value. |
asNumbers | Converts string values to numbers for all or selected keys. |
setPrefs | Sets the cookie preferences as a string into the cache. |
Function Descriptions
getPrefs
Gets a cookie set with a specific name's value.
Example Usage | Arguments | Return Value |
---|---|---|
ps.getPrefs(name ); | name - string of the name of the cookie set that you want (an example being 'topo_prefs') | an object representing the cookie set that you requested
|
asNumbers
Converts string values to numbers for all or selected keys.
Example Usage | Arguments | Return Value |
---|---|---|
ps.asNumbers(obj , keys ); |
| obj with all (or specified keys ) of its values converted from strings to numbers |
setPrefs
Sets the cookie preferences as a string into the cache.
Example Usage | Arguments | Return Value |
---|---|---|
ps.setPrefs(name , obj ); |
| none, but stores cookies |
* Cookies for the Topology View are stored as numbers 0 or 1 for toggle button state.