docs: correct description of output decorator and add links to guide (#31780)

PR Close #31780
This commit is contained in:
Judy Bogart 2019-08-06 08:08:02 -07:00 committed by Alex Rickabaugh
parent 2913340af7
commit 17e289c39f
3 changed files with 9 additions and 5 deletions

View File

@ -2,17 +2,17 @@
Angular makes use of observables as an interface to handle a variety of common asynchronous operations. For example:
* The `EventEmitter` class lets you use observables with the Angular `@Output` decorator.
* You can define [custom events](guide/template-syntax#custom-events-with-eventemitter) that send observable output data from a child to a parent component.
* The HTTP module uses observables to handle AJAX requests and responses.
* The Router and Forms modules use observables to listen for and respond to user-input events.
## Event emitter
## Transmitting data between components
Angular provides an `EventEmitter` class that is used when publishing values from a component through the `@Output()` decorator.
Angular provides an `EventEmitter` class that is used when publishing values from a component through the [`@Output()` decorator](guide/template-syntax#how-to-use-output).
`EventEmitter` extends [RxJS `Subject`](https://rxjs.dev/api/index/class/Subject), adding an `emit()` method so it can send arbitrary values.
When you call `emit()`, it passes the emitted value to the `next()` method of any subscribed observer.
A good example of usage can be found on the [EventEmitter](https://angular.io/api/core/EventEmitter) documentation. Here is the example component that listens for open and close events:
A good example of usage can be found in the [EventEmitter](https://angular.io/api/core/EventEmitter) documentation. Here is the example component that listens for open and close events:
`<zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>`

View File

@ -58,7 +58,7 @@ import {Subject, Subscription} from 'rxjs';
* <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
* ```
*
* @see [Observables: Event emitter](guide/observables-in-angular#event-emitter)
* @see [Observables in Angular](guide/observables-in-angular)
* @publicApi
*/
export class EventEmitter<T extends any> extends Subject<T> {

View File

@ -678,6 +678,8 @@ export interface InputDecorator {
* })
* class App {}
* ```
*
* @see [Input and Output properties](guide/template-syntax#input-and-output-properties)
*/
(bindingPropertyName?: string): any;
new (bindingPropertyName?: string): any;
@ -721,6 +723,8 @@ export interface OutputDecorator {
*
* See `Input` decorator for an example of providing a binding name.
*
* @see [Input and Output properties](guide/template-syntax#input-and-output-properties)
*
*/
(bindingPropertyName?: string): any;
new (bindingPropertyName?: string): any;