I've this subcomponent reference using @ViewChild
anotation:
@ViewChild(UserSubComponent)
private userManagementComponent: UserSubComponent;
I'd like to use this reference to perform scrollIntoView
.
Is it possible?
I've this subcomponent reference using @ViewChild
anotation:
@ViewChild(UserSubComponent)
private userManagementComponent: UserSubComponent;
I'd like to use this reference to perform scrollIntoView
.
Is it possible?
Change your selector so that it returns an ElementRef.
@ViewChild(UserSubComponent, {read: ElementRef})
private userManagementComponent: ElementRef;
then use the native element to scroll into view when you want:
ngOnInit(){
this.userManagementComponent.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
}