How to store values ​​between pages using knckout?

I am creating a web application using ASP.NET MVC and Knockout with which the user can add / remove items from the shopping cart. There are only 2 pages, the main page showing specials and the second showing all the offers, so basically the model behind is exactly the same. On each page, I can easily bind values ​​to the page controls, so if the user adds an item to the cart, the other parts are automatically updated. My problem is that I am losing data when I change the page. Is there anyway in the knockout so that I can save these changes between pages. My best bet so far has been to store the data on the server and retrieve it from the server again when I navigate to a new page. Hope someone can help :)

+3


source to share


1 answer


I took @ Matt.kaaj's approach which now works fine. I am just quoting it here:



It would be best to store the added item in your database whenever you add an item to the cat. You can use browser cookies or, but they are not something you can rely on. - Matt.kaaj

0


source







All Articles