3

Im using ngb modal to for a pop up where the content is set inside a <ng-template>. On submit (on error) I need to automatically scroll down to the error section. I tried @viewchild on the <div #error> but since its part of the template the viewchild value is always undefined. What would be the best way to access a div inside a template or to scroll automatically on ngbmodal to ots scroll height ?

Folgers123
  • 33
  • 6

1 Answers1

0

You don't need to use Angular for that. You can accomplish that with pure Javascript.

You could use <my-element id="someid"></my-element>

And then, with pure javascript, document.getElementById("someid").scrollIntoView()

slasky
  • 2,726
  • 4
  • 27
  • 36
Aleksandrus
  • 1,589
  • 2
  • 19
  • 31