I have a special template problem... I have a array of products, every products have a property "button_code", this property is a result in plain text of HTML laravel template with some angular code inside.
Actually im using a ng-bind-html="product.button_code" inside a and use this template inside a ng-repeat, the html code is correctly inserted in every repeat iteration, but the code is plain text, and I need to "wake up" the ng-controllers ng-clicks etc inside this html
I try with this:
var targets = $('.buy-button-container').toArray(); for (var target in targets) { console.log($(targets[target])); $compile($(targets[target]))($scope); } $scope.$apply(); But this make the code inside the container (all html code inserted in the ng-bind-html) dissapear of the DOM.
How i can do this? PD: and yes, im forced to use these template in these product.button_code because special things...)
Thanks
EDIT: This is a piece of code i want to bind:
<button class="buy-link btn btn-default" data-toggle="modal" role="button" ng-controller="BuyController" ng-click="doProduct({'id':'8888','title':'testestest','price':13.99,'currency':'EUR''preorder_enabled':false,'crossedPrice':100,'stock':true,'short_desc':'bla bla bla.','lbonus':false,'bonus_txt':false})"> <span class="left"> <i class="fa fa-cart"></i> <span itemprop="price">€13.99</span> </span> <span class="right"> {{GETIT}}</span> </button>
ng-includedirective? If fetches and compiles external html.