The Anubhav portal was launched in March 2015 at the behest of the Hon'ble Prime Minister for retiring government officials to leave a record of their experiences while in Govt service .
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
In Angular,
@Output()is used to send data or events from a child component to its parent component.Think of it as:
Why
@Outputis NeededAngular components are isolated. A child component cannot directly change parent data.
So Angular provides:
@Input()→ Parent ➜ Child@Output()→ Child ➜ ParentBasic Definition
@Output()marks an eventEventEmitteremits dataSimple Example
Child Component
Parent Component
How It Works (Internally)
$eventcontains emitted valueCustom Event Names
Emitting Objects
@Outputvs Callback FunctionBad practice:
Correct Angular way:
Best Practices
@Outputonly for events, not data storagesaved,deleted)Observablefor complex streamsReal-World Example