• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

490
Views
Passing data to a component from ModalController.create()

Is there a way that I can pass this itemId parameter so that the MarketPlaceItemPage can use that data?

async presentMarketplaceItem(itemId: number) {
    const modal = await this.modalController.create({
      component: MarketplaceItemPage,
      cssClass: '',
      mode: 'ios',
    });
    return await modal.present();
  }

I'm just not finding what I need in the Ionic documentation. Thanks in advance!

over 3 years ago · Santiago Trujillo
2 answers
Answer question

0

Here is the official documentation from Ionic

The property you are looking for is componentProps. Ionic controllers are not listed in their v5 documentation but their were listed under v4.

Another way (faster IMO) is to directly browse sources (ctrl+click), it will show you the controller method signature.

over 3 years ago · Santiago Trujillo Report

0

I found something that works from this website https://www.freakyjolly.com/ionic-modal-popovers-pass-receive-data/

async presentMarketplaceItem(itemId: number) {
    const modal = await this.modalController.create({
      component: MarketplaceItemPage,
      componentProps:{
        id: itemId
      },
      cssClass: '',
      mode: 'ios',
    });
    return await modal.present();
  }
over 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error