dimanche 22 novembre 2020

How trigger a function inside component whenever arguments change in Emnber octane

so i have a parent in controller like this

import Controller from '@ember/controller';

export default class IndexController extends Controller {
@service firebaseApp;
@service fastboot;
@tracked user =false;

async init(){
 super.init(...arguments);
 if (!this.fastboot.isFastBoot){
  const auth =  await this.firebaseApp.auth();
  auth.onAuthStateChanged((user)=>{
     if(user){
       this.user = true
     } else {
       this.user = false
     }
      })
     }
   }

then call a component loadData like this <LoadData @user=/>

the question is how to execute a function inside component loadData when @user change?




Aucun commentaire:

Enregistrer un commentaire