Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/430.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在爱奥尼亚不推荐订阅_Javascript_Ionic Framework_Rxjs - Fatal编程技术网

Javascript 在爱奥尼亚不推荐订阅

Javascript 在爱奥尼亚不推荐订阅,javascript,ionic-framework,rxjs,Javascript,Ionic Framework,Rxjs,我在爱奥尼亚项目中有这样一条警告:“订阅已弃用:使用观察者而不是完全回调”。请帮忙 fetch(cb) { this.loadingIndicator = true; this.cservice.postNcRangoConta(this.body).subscribe( res => { try { if (res) { this.headers = Object.keys(res[0]);

我在爱奥尼亚项目中有这样一条警告:“订阅已弃用:使用观察者而不是完全回调”。请帮忙

fetch(cb) {
    this.loadingIndicator = true;
    this.cservice.postNcRangoConta(this.body).subscribe(
      res => {
        try {
          if (res) {
            this.headers = Object.keys(res[0]);
            this.columns = this.getColumns(this.headers);
            this.temp = [...res];
            cb(res);
            this.loadingIndicator = false;
          }
        } catch (error) {
          this.loadingIndicator = false;
          this.rows = null;
          this.toast.presentToast('No se encontraron datos', 'warning');
        }
      },
      err => {
        console.log(err);
        if (this.desde || this.hasta) {

          this.loadingIndicator = false;
          this.toast.presentToast('La API no responde', 'danger');
        } else {
          this.loadingIndicator = false;
          this.toast.presentToast('Debe llenar las fechas', 'warning');
        }
      }
    );
  }

subscribe方法实际上并没有被弃用,但您使用它的方式已经被弃用。尝试切换到它的新语法

//已弃用
source.subscribe(
(res)=>cb(res),
error=>console.error(错误),
()=>console.log('Complete')
);
//推荐
source.subscribe({
下一步:(res)=>cb(res),
错误:error=>console.error(错误),
complete:()=>console.log('complete')
});

subscribe方法实际上并没有被弃用,但您使用它的方式已被弃用。尝试切换到它的新语法

//已弃用
source.subscribe(
(res)=>cb(res),
error=>console.error(错误),
()=>console.log('Complete')
);
//推荐
source.subscribe({
下一步:(res)=>cb(res),
错误:error=>console.error(错误),
complete:()=>console.log('complete')
});

Idk但仍突出显示“订阅”字Idk但仍突出显示“订阅”字