微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何通过 angular

如何解决如何通过 angular

文件上传一个数组 我希望它从一个组件一到组件二的路由传递

component-one.ts

     getimages(index:number): void {
    console.log(index)
    const folder = this.ImageFolder[index]
    this.getimagesService.getFiles(50,folder.path).snapshotChanges().pipe(
      map(changes =>
        // store the key
        changes.map(c => ({ key: c.payload.key,...c.payload.val() }))
      )
    ).subscribe(fileUploads => {
      this.fileUpload = fileUploads;
      if(fileUploads){
        console.log(fileUploads)
        this.router.navigate(['/category-product'],{ queryParams: this.fileUpload});
      }else{
        error=>{
          alert(error);
        }
      }
    });
    
  }

这是 component-two.ts

ngOnInit(): void {

    this.route.queryParams.subscribe( (param) => {
      console.log(param)
     // console.log(param);
 });

在 component-two.ts 中得到响应,例如 enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。