Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.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
Angular 角度:如何通过渲染组件在新选项卡中显示数据_Angular_Typescript_Angular8 - Fatal编程技术网

Angular 角度:如何通过渲染组件在新选项卡中显示数据

Angular 角度:如何通过渲染组件在新选项卡中显示数据,angular,typescript,angular8,Angular,Typescript,Angular8,这是完整的场景 我有一个ag网格,现在我双击其中一行并获取数据 rowDoubleClicked(row) { this.service.detail(this.a, row[this.a], this.detail).subscribe((data) => { // here i am able to get the data which is coming from backend. this.service.data.next(data); //

这是完整的场景

我有一个ag网格,现在我双击其中一行并获取数据

rowDoubleClicked(row) {
    this.service.detail(this.a, row[this.a], this.detail).subscribe((data) => {

      // here i am able to get the data which is coming from backend.

      this.service.data.next(data); // via this I am sending the data to detail component

      window.open("detailComponent", "_blank");  // opening the detail component in different tab
    });

  }
详图构件

constructor(private service: Service) {
    this.service.data.subscribe((data) => {
      this.data= data;
      alert("a"); //  it is also not working
      debugger;
    });

  }
html文件

<div *ngFor="let item of data | keyvalue">
    {{item}}
    {{item.key}}:{{item.value}}
  </div>
  abc{{data}}    // html page only showing abc

{{item}}
{{item.key}}:{{item.value}
abc{{data}}//html页面仅显示abc
服务文件

readonly data = new ReplaySubject<any>(1);
readonly data=新的ReplaySubject(1);
根据逻辑细节,组件应显示我双击ag网格发送的数据。但它只显示本质上是静态的数据


因此,基本上如何以角度发送新选项卡上的数据。

有两种方法可以将数据从一个选项卡发送到另一个选项卡

1.本地存储

设置数据

localStorage.setItem('key', JSON.stringify(value));
获取数据

this.obj= JSON.parse(localStorage.getItem('key'));
删除数据

   localStorage.removeItem('key');
2。window.postMessage()

另外,但不确定

window.document.write()
从一个选项卡向另一个选项卡发送数据的两种方法

1.本地存储

设置数据

localStorage.setItem('key', JSON.stringify(value));
获取数据

this.obj= JSON.parse(localStorage.getItem('key'));
删除数据

   localStorage.removeItem('key');
2。window.postMessage()

另外,但不确定

window.document.write()