Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Persistent State Control for showRaw and hiddenLabel Checkboxes #11

Merged
merged 3 commits into from
Oct 31, 2024

Conversation

lucasferreiralimax
Copy link
Member

This PR adds persistent state management for showRaw and hiddenLabel checkboxes in the ListTechsComponent. Using localStorage, this implementation retains the checkbox selections across sessions, ensuring a consistent user experience.

Changes Made

  1. Component State Initialization:

    • Added showRaw and hiddenLabel properties to the ListTechsComponent.
    • Initialized these properties in ngOnInit, retrieving any existing values from localStorage.
  2. Checkbox Template Update:

    • Created two checkboxes in the list-techs.component.html template, using [(ngModel)] for two-way binding to showRaw and hiddenLabel.
  3. Persistent Storage on Change:

    • Added an onCheckboxChange method that updates localStorage whenever a checkbox is toggled.
    • Ensured TypeScript type safety by limiting key to 'showRaw' or 'hiddenLabel' and using a helper method to access the properties dynamically.

@lucasferreiralimax
Copy link
Member Author

Screenshot 2024-10-31 at 04 36 19 Screenshot 2024-10-31 at 04 36 26 Screenshot 2024-10-31 at 04 36 32

@lucasferreiralimax lucasferreiralimax merged commit cbf1aab into master Oct 31, 2024
2 checks passed
Copy link

Visit the preview URL for this PR (updated for commit 9894c37):

https://angular-techs-logos--pr11-state-control-raw-an-rvkpz3nn.web.app

(expires Thu, 07 Nov 2024 07:37:12 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 1e6be52cb30c4b8fc438baf494ecc8ac65a6ec48

@lucasferreiralimax lucasferreiralimax deleted the state-control-raw-and-hidden-label branch October 31, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement State Control with localStorage for Checkboxes (showRaw and hiddenLabel)
1 participant