docs: add ngOnInit description (#32789)

PR Close #32789
This commit is contained in:
Nikita Potapenko 2019-09-20 13:14:04 +03:00 committed by atscott
parent 41ed694d01
commit 3c7ac5f835
1 changed files with 9 additions and 1 deletions

View File

@ -90,9 +90,17 @@ The product details component handles the display of each product. The Angular R
<code-example path="getting-started/src/app/product-details/product-details.component.1.ts" region="get-product">
</code-example>
Angular calls `ngOnInit()` shortly after creating a component.
The route parameters correspond to the path variables defined in the route. The `productId` is provided from
the URL that was matched to the route. You use the `productId` to display the details for each unique product.
<div class="alert is-helpful">
For more information on `ngOnInit()`, see [Lifecycle hooks](guide/lifecycle-hooks).
</div>
1. Update the template to display product details information inside an `*ngIf`.
<code-example header="src/app/product-details/product-details.component.html" path="getting-started/src/app/product-details/product-details.component.html" region="details">