ic-local-vars - The Local Vars Attribute

Summary

The ic-local-vars attribute tells Intercooler to include parameters from localStorage in your intercooler requests. This can be used to maintain local state that is persistent and not encoded directly in the DOM.

Syntax

The value of the ic-local-vars attribute is a comma separated list of string names that will be used to index into the localStorage object.

This attribute may be placed on parent elements, allowing you to specify behavior across multiple elements.

Note that the X-IC-Set-Local-Vars response header can be used to write values into localStorage

Dependencies

ic-local-vars has no effect on dependencies.

Example

In this example, the button includes a local variable when it POSTs to the server.

  <button ic-post-to="/update" ic-local-var="foo">Upload Local Var</button>