Skip to content

Commit

Permalink
docs: add note that when ngOnInit not used (angular#34619)
Browse files Browse the repository at this point in the history
In some examples ngOnInit was missing added note to tell when it is missing.

Fixes angular#34562

PR Close angular#34619
  • Loading branch information
ajitsinghkaler authored and atscott committed Jan 10, 2020
1 parent e88d652 commit f6dee72
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions aio/content/start/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,13 @@ To make the "Notify Me" button work, you need to configure two things:

1. In the component class, define a property named `notify` with an `@Output()` decorator and an instance of `EventEmitter()`. This allows the product alert component to emit an event when the value of the notify property changes.

<div class="alert is-helpful">

When the Angular CLI generates a new component, it includes an empty constructor, the `OnInit` interface, and the `ngOnInit()` method.
Since the following example isn't using them, they are omitted here for brevity.

</div>

<code-example path="getting-started/src/app/product-alerts/product-alerts.component.ts" header="src/app/product-alerts/product-alerts.component.ts" region="input-output"></code-example>

1. In the product alert template, `product-alerts.component.html`, update the "Notify Me" button with an event binding to call the `notify.emit()` method.
Expand Down

0 comments on commit f6dee72

Please sign in to comment.