docs: add note that when ngOnInit not used (#34619)
In some examples ngOnInit was missing added note to tell when it is missing. Fixes #34562 PR Close #34619
This commit is contained in:
parent
e88d652f2a
commit
f6dee72a88
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue