Have questions? Stuck? Please check our FAQ for some common questions and answers.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

This page is a work in progress.

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.

NameSummary
getPrefsGets a cookie with a specific name's value.
asNumbersConverts string values to numbers for all or selected keys.
setPrefsSets the cookie preferences as a string into the cache.

Function Descriptions

getPrefs

Gets a cookie with a specific name's value.

Example UsageArgumentsReturn Value
ps.getPrefs(name);name - string of the name of the cookie that you want

an object representing the cookie that you requested, the format being:

name: value of cookie

null if no cookie for name exists

asNumbers

Converts string values to numbers for all or selected keys.

Example UsageArgumentsReturn Value
ps.asNumbers(obj, keys);

obj - cookie object that has string values representing numbers

keys - (optional) a set of keys that you want their values to be converted to numbers. If this value is falsy, then all keys in obj will be converted to numbers.

 

 

setPrefs

 

 

 

 

 

  • No labels