When the $compile-line binding of an angular HTML template, I try to add additional controllers and directives inside the tag<script> and use the ones contained in the HTML template.
Thus, I try to implement some kind of plug-in mechanism so that I can download external files that extend the functionality of my application.
The tag <script>really gets evaluated, but my problem is that compiling the HTML template takes place before evaluating JavaScript. Therefore, the compiler complains about the lack of controllers.
Example:
http://plnkr.co/edit/8oZYhRHAjP84ecnl6hG3?p=preview
In this example, an error occurs: Error: Argument 'Controller' is not a function, got undefined
If you delete lines 15-18 (HTML that refers to the created pipeline) in app.js, you can see in the console that creating this controller really works.
Felix source
share