Javascript 从数组到模态参数获取值

Javascript 从数组到模态参数获取值,javascript,angular,ionic-framework,Javascript,Angular,Ionic Framework,我想通过数组中的值来更改模态组件参数。但我不知道怎么做。当传递数组时,它接受代码写入,而不是数组值 componentArray: any[] = [{component: 'modal1Page'}, {component: 'modal2Page'}]; async onClick(value: any) { const myModal = await this.modalController.create({ component: this.componen

我想通过数组中的值来更改模态组件参数。但我不知道怎么做。当传递数组时,它接受代码写入,而不是数组值

componentArray: any[] = [{component: 'modal1Page'}, {component: 'modal2Page'}];

  async onClick(value: any) {
     const myModal = await this.modalController.create({ 
      component: this.componentArray[0],
      cssClass: 'modalCss',
      componentProps: {
        value: value,
      }
    });
    return await myModal.present();
  }
它是这样解释的:组件:这个.组件数组[0];我希望它是这样解释的:组件:modal1Page

谢谢你的帮助

我想你错过了。组件


非常感谢!!
async onClick(value: any) {
     const myModal = await this.modalController.create({ 
      component: this.componentArray[0].component,
      cssClass: 'modalCss',
      componentProps: {
        value: value,
      }
    });
    return await myModal.present();
  }