对可观察对象的更改会将值放入localStorage和

时间:2018-09-25 12:27:29

标签: angular typescript rxjs

我进行了排序,如果用户单击“记住”复选框,则对象值将存储在localStorage中,因此,下次他们访问应用程序时,localStorage中的值将保留在位置排序中。更改表单中的值并选中复选框后,对象值将在localStorage中更新。

{
    "/api/*": {
      "target": "http://localhost:8080/cystock/",
      "secure": false,
      "pathRewrite": {"^/api" : ""},
      "changeOrigin": true,
      "logLevel": "debug"
    }
  }

HTML:

export const GLOBAL = {
  production: true,
  url: 'api'//<-- 'API/' prefix needed for proxy configuration 
};

观察到该复选框上的事件,但不应调用 /**@property locationSubject is next observable @property locBody values */ subscribeToLocBody() { const lcl: Storage = localStorage; this.locationSubject .pipe(catchError(err => of(err)), debounceTime(300)) .subscribe((locInputVal: ILocation<any>) => { this.locBody = locInputVal; console.log(this.locBody); (locInputVal.remember ? lcl.setItem('remember', JSON.stringify(this.locBody)) : lcl.removeItem('remember')); this.initStoryLocationSort(locInputVal); }) } ,而仅将主体添加到localstorage。在仍然观察对象主体的值变化的同时如何实现呢?

0 个答案:

没有答案