• Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Post job
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

311
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 1 year 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 1 year 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 1 year ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

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