ReferenceError: localStorage is not defined

前端 未结 3 2296
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-05 02:13

I am trying to make User Authentication with Angular and ASP.NET Core.

I am following the tutorial found here:

https://fullstackmark.com/post/10/user-authent

3条回答
  •  孤街浪徒
    2021-01-05 02:55

    You can use standard API for localstorage, like

    localStorage.setItem(k, v)
    

    and

    localStorage.getItem(k)
    

    but If you want a angular solution for this and find a good library for localstorage, one I'm using is this

    https://github.com/marcj/angular2-localstorage

    also

    https://www.npmjs.com/package/angular2-cool-storage

    is cool to use.

提交回复
热议问题