Pregunta

I am using amplify.store to store a variable for the current tab clicked on a page, when I go the another page (the history version of that page) it stays on the same clicked tab which is the desired behavior. I am running into an issue though because the amplify.store is retained across sessions.
I am currently using the current code to store the val.

amplify.store("CurrentTab","SomeVal");

I try clearing the amplifystore when clicking on the button for the menu, however I am not sure why it doesn't work. Below is my clear command

    <script>
    $("#hreftothelink").click(function () {
        amplify.store("CurrentTabH",null);
        amplify.store("CurrentTab",null);
        someViewModel()
                .tabs('select','someVal');
    });
    </script>

Is there another way that anyone can think of to clear the val or pass a variable based on what tab that is currently selected?

Note: Using a timed destroy of the amplify.store would not work since there is a variable amount of time someone can be on the tab.

¿Fue útil?

Solución

I added this to the click and I was able to clear the value.

var CurrentTabH = amplify.store("CurrentTabH");
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top