angular - Use property from output binding in parent component -


i'm sure must missing simple here, have child component emits object via output event. parent component subscribes output in template this:

<div class="tree-panel-container">     <div class="tree-panel-content">         <content-tree (contextselected)="contextpanelselected($event);"></content-tree>     </div>     <context-panel>         <div class="context-panel">             <h2>{{contexttitle}}</h2>         </div>     </context-panel> </div> 

within exported class of same component function this:

contextpanelselected($event) {     console.log($event); } 

the console.log in function correct, know output object coming through expected. want though use property on output object populate value of {{contexttitle}} in template.

can suggest how this?

many thanks.

you use following:

contextpanelselected(value) {   console.log(value);   this.contexttitle = value; } 

in following code:

(contextselected)="contextpanelselected($event)" 

$event corresponds data sent through event contextselected.emit('some text'). value can passed parameter of contextpanelselected method. method responsible of setting parameter contexttitle property of component.


Popular posts from this blog

Apache NiFi ExecuteScript: Groovy script to replace Json values via a mapping file -

python 3.x - PyQt5 - Signal : pyqtSignal no method connect -