Skip to main content
2 of 3
deleted 18 characters in body
Mohith Shrivastava
  • 92k
  • 19
  • 161
  • 214

Locker Service DOM accessibility when action invoked via method

I have a lightning component setup where in a parent component I dynamically create a component and assign it to an <aura:attribute type="Aura.Component" />. The dynamically created child component has an <aura:method /> on it. The controller action for that method does some DOM manipulation on a node inside the dynamically created component (this should be totally valid in Locker Service since we are accessing a DOM node inside the same component). However, getElement() is not available when the component was dynamically created. If I instead directly place the component inside the parent component with <c:myCmp /> when I call the same function getElement() is available.

Is there something special I need to do in order to make sure dynamically created components have getElement() available within their own controller code or is this simply a bug in Locker Service?

If need be I can put together a reduced test case and throw it in a gist.

dsharrison
  • 4k
  • 1
  • 24
  • 57