Carlo A
Carlo A

Reputation: 117

An argument was not provided whenever I subscribe a function to a service

I am trying to subscribe my function to an even emitter, but I get

An argument for 'eprompt' was not provided

I am new to this one that's why I really don't know any workaround solutions.

     console.log(listtasksobs);
     this.listtask  = listtasksobs;
   })


   if (this.eventEmitterService.subsVar==undefined){
     this.eventEmitterService.subsVar = this.eventEmitterService
                                            .invokeTaskEditFunction
                                            .subscribe(()=>{


       //PROBLEM HERE
       this.editprompt(); //<<--- it shows : An argument for 'eprompt' was not provided
     });
   }
 }


 //load-editpromptlist
 editprompt(eprompt:taskdb): void {
   this.epromptshow = eprompt;

   const dialogRef = this.dialog.open(TaskeditpromptComponent, {
     width: '650px',

   });

   dialogRef.afterClosed().subscribe(result => {
     console.log('The dialog was closed');
   });
 }

Upvotes: 0

Views: 2168

Answers (1)

Sam
Sam

Reputation: 1861

Your editprompt() function take an eprompt parameter. You need to pass this parameter into the function when you call it. For example this.editprompt(yourParameter). Alternatively you can set a default value or make the parameter optional.

Optional

editprompt(eprompt?) {}

Default Value

editprompt(eprompt = 'value') {}

Upvotes: 0

Related Questions