How to keep localStorage values after refresh?

后端 未结 6 766
挽巷
挽巷 2020-12-19 15:09

This is my ctrl:

app.controller(\'ctrl\', function ($window, $scope) {

    $scope.initData = [
        {
            firstName: \"John\",
            lastNa         


        
6条回答
  •  旧巷少年郎
    2020-12-19 15:52

    On every page load you are setting new initData and updating the local storage... Instead you should check for existing localstorage data and use that before using the mocked initData

提交回复
热议问题