Data from Child Component to Parent. Best approach?

Hey Guys.

I am trying to implement search feature. Looks something like this.
This is my parent component:


Once you click to Advanced it goes to modalController where you can select different filters:

I want to filter my search result by those filter by passing object called data.
So. I have an object in my parent component Search.ts
Facebook property should be either 1 or 0 and so on.

 data = {
      search: '',
      facebook: ''

And I want to update facebook property from childComponent once Facebook Allowed is toggled.

I am not sure what is the best way to do it?
Any ideas would be highly appreciated!


Are u sure you are in v1? As you have ts file?

If you are in v2 or higher, check the docs on modalcontroller. You need to define a ondismiss handler


Hey Tom,
You are right, I’m not on v1 :wink: my bad

could you give me an example with ondismiss handler?
it’s a little bit confusing .


Easy as cake

 presentProfileModal() {
   let profileModal = this.modalCtrl.create(Profile, { userId: 8675309 });
   profileModal.onDidDismiss(data => {

Just copy/past example

Otherwise: check the ionic preview app, which showcases all the goodies.