Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Controller definition inside ng-view #11384

Closed
michaldudak opened this issue Mar 20, 2015 · 3 comments
Closed

Controller definition inside ng-view #11384

michaldudak opened this issue Mar 20, 2015 · 3 comments

Comments

@michaldudak
Copy link

If a ngRoute view contains an inline script with controller definition, that controller fails to register. A workaround is to enable $controllerProvider.allowGlobals(); and define a controller as a global function, but the recommended approach does not work.

Here's the plunker showing the problem: http://plnkr.co/edit/JU350xL7X9ryF3S72o6s

Click on the link there to change the route and take a look at the browser's console.

@wesleycho
Copy link
Contributor

I'm not sure this is behavior that was intended to be supported.

@pkozlowski-opensource
Copy link
Member

Nope, currently there is no mechanism to load controllers on demand. We are working on it and @btford owns the topic, you can read more about it here: #11015

Global controllers were dropped in 1.3 so this is not a path to take either.

Closing as duplicate of #11015

@michaldudak
Copy link
Author

Thanks, good to know you're taking it into consideration.

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

No branches or pull requests

3 participants