In Angular 5 project, I want to make a scroll to the top of the page which will be called on page load. Below is my code in update-product.component.ts :

```
export class UpdateProductComponent implements OnInit, ngAfterViewChecked 
{
    productUpdateForm: FormGroup;
    dataInvalid = false;
    formErrors = []; 
}

ngAfterViewChecked() {
    window.scrollTo(0, 0);
}

```

However, as mentioned below, I received such an error message when I run the command: `ng serve` from terminal.

> 
> ERROR in src/app/update-product/update-product.component.ts(15,56):
>  error TS2304: Cannot find name 'ngAfterViewChecked'.
> 
> 
> 

But, also note, sometimes the code runs and scrolls properly. But shows the error when run `ng serve` command.