Hi,
I have a simple login screen where user enters any username and any password... The entered values are stored in localStorage using setItem.
I then navigate to a different screen which has a ViewModel and a single property that reads the value from localStorage and displays it on the screen.
I can see from debugger that the values are correctly being stored when I click sign in, but sometimes (most times infact) when I navigate to the second screen the values are not shown, or an old value is shown.... It is kind of like I need to refresh the datamodel from localStorage when I init, beforeShow, or show the second view...
Can anyone shed any light on what I am missing... sample app developed in VS extension and available if required, but i cant attach cos it is > 2mb and not an image!!
Many thanks
I have a simple login screen where user enters any username and any password... The entered values are stored in localStorage using setItem.
// Set local storage values
localStorage.setItem("Username", username);
localStorage.setItem("Password", password);
localStorage.setItem("DisplayName", "Woot Woot - " + username );
utils.navigate("#menu-view");
I then navigate to a different screen which has a ViewModel and a single property that reads the value from localStorage and displays it on the screen.
define(["kendo"], function (kendo) {
return {
init: function (initEvt) {},
beforeShow: function (beforeShowEvt) {},
show: function (showEvt) { },
viewModel: kendo.observable({
displayName: localStorage.getItem("DisplayName")
})
};
});
I can see from debugger that the values are correctly being stored when I click sign in, but sometimes (most times infact) when I navigate to the second screen the values are not shown, or an old value is shown.... It is kind of like I need to refresh the datamodel from localStorage when I init, beforeShow, or show the second view...
Can anyone shed any light on what I am missing... sample app developed in VS extension and available if required, but i cant attach cos it is > 2mb and not an image!!
Many thanks