docs: Added missing explanation of implements OnInit (#51634)

PR Close #51634
This commit is contained in:
SrinathSree 2023-09-02 17:49:40 +05:30 committed by Jessica Janiuk
parent ca1dac2ada
commit b6844a9056

View file

@ -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>