typescript - Angular2 output double parameter signature -
hello there way pass 2 parameters in output function child component.
i want call markquestion child component(answer-sheet) (q_number, value) parameters gives me errors.
it works 1 parameter.
<answer-sheet *ngif="current_question" [questions]="questions" [question] = "current_question" [answer_list]="answers" (markquestion)="markquestion($event)"> </answer-sheet>
markquestion(q_number:number, val:number){ console.log(q_number , "numaralı soru cevap anahtarından ", val, " olarak isaretlendi" ); //this.answers[q_number[0]] = {q_number[1]}; }
export class answers { // @input() question: object; @output() markquestion = new eventemitter(); @input() answer_list; public question: object; nextquestionansweredbutton(q_number,val){ //there error @ calling next function -> supplied parameters not match .. this.markquestion.next(q_number,val); } }
you can pass object
markquestion.emit({q_number: q_number, value: value});
markquestion(event:object){ console.log(event.q_number , "numaralı soru cevap anahtarından ", event.val, " olarak isaretlendi" ); //this.answers[event.q_number[0]] = {event.q_number[1]}; }
otherwise no can't pass more parameters @output()
Comments
Post a Comment