mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
docs: Added missing explanation of implements OnInit (#51634)
PR Close #51634
This commit is contained in:
parent
ca1dac2ada
commit
b6844a9056
1 changed files with 2 additions and 2 deletions
|
|
@ -60,11 +60,11 @@ The Angular Router displays components based on the browser's URL and [your defi
|
|||
|
||||
In this section, you'll use the Angular Router to combine the `products` data and route information to display the specific details for each product.
|
||||
|
||||
1. In `product-details.component.ts`, import `ActivatedRoute` from `@angular/router`, and the `products` array from `../products`.
|
||||
1. In `product-details.component.ts`, import `ActivatedRoute` from `@angular/router`, import `OnInit` from `@angular/core`, and the `products` array from `../products`.
|
||||
|
||||
<code-example header="src/app/product-details/product-details.component.ts" path="getting-started/src/app/product-details/product-details.component.1.ts" region="imports"></code-example>
|
||||
|
||||
1. Define the `product` property.
|
||||
1. Define the `product` property. The `implements OnInit` statement indicates that the class implements the `OnInit` interface, requiring the implementation of the `ngOnInit` method for initialization tasks when the component is created.
|
||||
|
||||
<code-example header="src/app/product-details/product-details.component.ts" path="getting-started/src/app/product-details/product-details.component.1.ts" region="product-prop"></code-example>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue