You can't do that, the script never gets called... See:
http://plnkr.co/edit/XJJFP5iPRxMqVNt2psJZ?p=preview Apart from being a Bad Code Smell :), what you are trying to do can be achieved with document.createElement... But,in any case, this does what you want: http://plnkr.co/edit/KCJk9ikLYraLcM9jHhT9?p=preview On Wednesday, February 19, 2014 12:06:33 PM UTC-5, Pierre Marot wrote: > > I'll add a more precise question as my previous one was maybe not clear. > > How could I use $compile to compile div like <div ng="mySlideCtrl10">.. > </div> *with* its controller ? > > The slides appear in the "Ace" editor, so I wish users could edit the code > and see the result in live. > > Le mercredi 19 février 2014 15:44:49 UTC+1, Pierre Marot a écrit : >> >> Hello, >> >> I have an application that contains slides for presentations and thing >> like that. >> >> Each slide is represented by a html snippet and a javascript function >> (the controller for that snippet). >> >> When loading a slide, a snippet containing the controller inside a script >> tag are loaded. Then it needs to be compiled. >> >> There, It can't find my controller function when I compile with : $compile >> (element.contents())(scope); >> >> This error is thrown : Error: [ng:areq] Argument 'ApplyCtrl' is not a >> function, got undefined >> >> I made a quick plunkr to illustrate my problem. What do I do wrong ? >> >> http://plnkr.co/edit/KZYiFMwDErX8mx7gZu42?p=preview >> >> Thank you. >> >> Pierre >> > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
