Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.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
Node.js this.zone.run()-Ngzone错误_Node.js_Angular_Sockets_Sails.js - Fatal编程技术网

Node.js this.zone.run()-Ngzone错误

Node.js this.zone.run()-Ngzone错误,node.js,angular,sockets,sails.js,Node.js,Angular,Sockets,Sails.js,我的帆+帆座+角有问题4 当套接字广播数据时,会运行this.socket.on(“updateAposts”)行,但ngZone不起作用 zone.js:196未捕获类型错误:无法读取未定义的属性“run” 我想在接收套接字数据时更新要查看的数据。请帮帮我! 谢谢大家! 这里也一样。从蓝调的东西里出来的。突然出现 import { Component, OnInit, NgZone } from '@angular/core'; import { routerTransition } from

我的帆+帆座+角有问题4

当套接字广播数据时,会运行this.socket.on(“updateAposts”)行,但ngZone不起作用

zone.js:196未捕获类型错误:无法读取未定义的属性“run”

我想在接收套接字数据时更新要查看的数据。请帮帮我!
谢谢大家!

这里也一样。从蓝调的东西里出来的。突然出现
import { Component, OnInit, NgZone } from '@angular/core';
import { routerTransition } from '../../router.animations';
import { Http } from '@angular/http';
import * as socketIOClient from 'socket.io-client';
import * as sailsIOClient  from 'sails.io.js';

@Component({
  selector: 'app-tables',
  templateUrl: './tables.component.html',
  styleUrls: ['./tables.component.scss'],
  animations: [routerTransition()]
})
export class TablesComponent implements OnInit {
  io:any;
  smartTableData:any;

  constructor(public http: Http, private zone: NgZone) {

      this.io = sailsIOClient(socketIOClient);
      this.io.sails.url = "http://localhost:1337";

      this.io.socket.get('/posts', function(resData, jwr) {
          console.log (resData);
          return resData;


      });

      this.io.socket.on('updateposts', function(data) {
          this.zone.run(() => {
              this.smartTableData = data;
          });
      });


}

ngOnInit() {

}

}