Skip to main content

Save Attribute

The $save directive is used to persist specific state properties to local storage.

Usage

~index.html
<div $save="{propertyName}"></div>

How it Works

  • The framework identifies properties marked with $save.
  • These properties are automatically saved to local storage when they change.
  • On page reload, the saved values are restored from local storage.

Error Handling

If the property doesn't exist in the state, a warning is logged to the console.

Note

note

This directive is useful for maintaining state across page reloads, improving user experience in single-page applications.