How to return a value from an EventEmitter function?

后端 未结 2 1549
时光说笑
时光说笑 2020-12-13 05:37

I got this function in my core component:

 isValid(value: any) {

   // Do some stuff and return somethin         


        
2条回答
  •  误落风尘
    2020-12-13 06:38

    You need to subscribe on the event emitter to get the value:

    this.onBeforeAdding.emit(value || true);
    
    this.onBeforeAdding.subscribe(isValid => {
      if (isValid) {
        // Do stuff
      }
    });
    

提交回复
热议问题