Skip to content

State: onEnter callback executed before template added to DOM #575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
iandev opened this issue Nov 12, 2013 · 5 comments
Closed

State: onEnter callback executed before template added to DOM #575

iandev opened this issue Nov 12, 2013 · 5 comments

Comments

@iandev
Copy link

iandev commented Nov 12, 2013

A states onEnter callback is executed before the template is added to the DOM. In the UI router docs, one of the examples shows a modal dialog being triggered in the state onEnter callback. This is fine, but in the example, the modal doesn't rely on the template being in the DOM already. So, according to the docs, the onEnter/onExit is a good place to open/close a modal dialog, but the states template should be in the DOM by the time the onEnter callback is fired.

@nateabele
Copy link
Contributor

So, according to the docs, the onEnter/onExit is a good place to open/close a modal dialog, but the states template should be in the DOM by the time the onEnter callback is fired.

I don't understand. Is there a question in here?

@iandev
Copy link
Author

iandev commented Nov 12, 2013

No, I am saying that onEnter should be fired after the template is added to the DOM. To me, the state has not fully entered until the template is in the DOM. If you don't agree that's fine.

@timkindberg
Copy link
Contributor

I could see it from that pov.

@nateabele
Copy link
Contributor

Well, even if I agreed (which I mostly don't, but we can see about adding another callback if there's a genuine use case), what would you do? Keep in mind, you're still not allowed to touch scopes or the DOM from onEnter either way.

@eddiemonge
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants