events - Issue with @Output in angular -


​hi trying throw 1 event second component first component not able event in first component , able catch event in app component.is there limitation of can catch event child app component only.thanks in advance.

enter image description here

i catching event ​

<second-app (newevent) = "onemit($event)"></second-app> 

please find folder structure:

           second.component        first.component app.component 

you can use @output event processing communication between nested (child) component , parent component.

to communicate between sibling components or unrelated components, can use service. have example service here: https://blogs.msmvps.com/deborahk/build-a-simple-angular-service-to-share-data/

the plunker here: https://plnkr.co/edit/kt4jlmpcwgbm2xdzqei9?p=preview

the service looks this:

import { injectable } '@angular/core';  @injectable()  export class dataservice {   servicedata: string;  } 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -