Package org.angular.ts.ng
Interface CookieService
@JsType(isNative=true,
name="ng.CookieService",
namespace="<global>")
public interface CookieService
High-level API for reading, writing, serializing, and removing browser cookies through the injectable `$cookie` service.
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves a raw cookie value.jsinterop.base.JsPropertyMap<String> getAll()Returns an object containing all raw cookies.Retrieves a cookie and deserializes its JSON content.voidput(String key, String value, CookieOptions options) Sets a raw cookie value.voidputObject(String key, Object value, CookieOptions options) Serializes an object as JSON and stores it as a cookie.voidremove(String key, CookieOptions options) Removes a cookie by setting an expired date.
-
Method Details
-
get
Retrieves a raw cookie value.- Parameters:
key- Cookie name to read.- Returns:
- Method result.
-
getAll
jsinterop.base.JsPropertyMap<String> getAll()Returns an object containing all raw cookies.- Returns:
- Method result.
-
getObject
Retrieves a cookie and deserializes its JSON content.- Parameters:
key- Cookie name to read.- Returns:
- Method result.
-
put
Sets a raw cookie value.- Parameters:
key- Cookie name to write.value- String value to write.options- Cookie attributes for this write.
-
putObject
Serializes an object as JSON and stores it as a cookie.- Parameters:
key- Cookie name to write.value- JSON-serializable value.options- Cookie attributes for this write.
-
remove
Removes a cookie by setting an expired date.- Parameters:
key- Cookie name to remove.options- Cookie attributes that must match the existing cookie.
-