You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ".noConflict()" method is used only in browser environments that load Cookies as a global variable. It is not necessary in UMD or AMD environments (they don't expose the .noConflict() method). In this case you just need to include js.cookie.js before angular.js.
Due to the nature of the "converter" API it is also possible to easily create specific instances for each use-case (The implementation below was taken from the write-converters PR):
module.factory("phpCookies",function(){returnCookies.noConflict().withConverter(function(value,name){returnvalue// Decode all characters according to the "encodeURIComponent" spec.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)// Decode the plus sign to spaces.replace(/\+/g,' ')});});
Since js-cookie has no dependencies it is pretty easy to integrate with Angular with a simple service:
The ".noConflict()" method is used only in browser environments that load
Cookies
as a global variable. It is not necessary in UMD or AMD environments (they don't expose the.noConflict()
method). In this case you just need to includejs.cookie.js
beforeangular.js
.Due to the nature of the "converter" API it is also possible to easily create specific instances for each use-case (The implementation below was taken from the write-converters PR):
The usage would be something like this:
It might be worth documenting this somewhere, including any other framework integration that might leverage the way this API was designed.
The text was updated successfully, but these errors were encountered: