Suggest an editImprove this articleRefine the answer for “What does ngOnInit() do? When is it called?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)In Angular, `ngOnInit()` is a lifecycle hook that **is called once, after a component's input properties (**`@Input`**) are initialized**. **Key point:** `ngOnInit` is the place for initial component setup, once all the data is already available, and it runs only once.Shown above the full answer for quick recall.Answer (EN)ImageIn Angular, `ngOnInit()` is a lifecycle hook that **is called once, after a component's input properties (**`@Input`**) are initialized**. ## Key points 1. **What it does**: - Used to **initialize the component's logic** once all the input data is already available. - Suitable for loading data, setting up the initial state, and calling services. 2. **When it is called**: - **Once**, after the input property values are first passed and before the component's first render. - Called **after** `ngOnChanges()`, if there are input properties. Example: ```ts export class ChildComponent implements OnInit { @Input() name: string; ngOnInit() { console.log('Component initialized, name:', this.name); } } ``` - At this point, `name` already contains the value passed by the parent. In other words, `ngOnInit` **is the place for initial component setup, once all the data is already available**, and it runs only once.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.