# Impossibile accedere all'elemento definito nell'outlet del plugin con l'interfaccia DOM

**URL:** <https://meta.discourse.org/t/cant-access-element-defined-in-plugin-outlet-with-dom-interface/185213>\
**Category:** Development\
**Created:** [2 Aprile 2021, 6:44am UTC](https://meta.discourse.org/t/cant-access-element-defined-in-plugin-outlet-with-dom-interface/185213 "2021-04-02T06:44:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [2 Aprile 2021, 7:54am UTC](https://meta.discourse.org/t/cant-access-element-defined-in-plugin-outlet-with-dom-interface/185213/2 "2021-04-02T07:54:48Z")

</div>

Probabilmente sta eseguendo il selettore prima che il template sia stato renderizzato.

Devi farlo ‘all’interno del framework’.

L’approccio migliore sarebbe trasformare questo in un Componente Ember, quindi utilizzare un hook come `didInsertElement()` per catturare il momento in cui è disponibile per la modifica.

Ricorda che si tratta di un’applicazione web, non di una pagina web. Gli elementi sono dinamici, non statici. L’outlet del plugin è esso stesso un Componente, quindi non viene renderizzato immediatamente.

> **[The Component Lifecycle - Components - Ember Guides](https://guides.emberjs.com/v3.12.0/components/the-component-lifecycle/)**
>
> Part of what makes components so useful is that they let you take complete control of a section of the DOM. This allows for direct DOM manipulation, listening and responding to browser events, and using 3rd party JavaScript libraries in your Ember...

---

_[View the full topic](https://meta.discourse.org/t/cant-access-element-defined-in-plugin-outlet-with-dom-interface/185213)._
