1,传值问题

page setValue:  [routerLink]="['/product-details', product.id]">  

ts     seValue:    this.router.navigate(['/product-details', id]);

ts     getVaue:    

constructor(private route: ActivatedRoute) {}
export class LoanDetailsPage implements OnInit, OnDestroy {
id: number;
private sub: any;
constructor(private route: ActivatedRoute) {}
ngOnInit() {
this.sub = this.route.params.subscribe(params => {
this.id = +params['id']; // (+) converts string 'id' to a number

// In a real app: dispatch action to load the details here.
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
}

2,model

export class Gundam{
id:number;
name:String;
}

import {Gundam} form '../model/gundam';
export class GUNDAMS:Gundam[]=[]

相关文章:

  • 2021-08-09
  • 2022-01-23
  • 2021-10-23
  • 2021-05-19
  • 2021-08-07
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-24
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
相关资源
相似解决方案