0

I have a Scopevariable which contains the html-Code of a button with a ng-click Attribute and want to assemble the the Page dynamically.

$scope.myHtml = "<button class="someclass" ng-click="clickme()">Button</button>

and i am currently using the html like this:

<div ng-bind-html="myHTML"></div>

The Button displays pretty fine but the ng-click got removed, so how can i keep the angular expressions from the variable?


Thanks in advance!

1 Answers1

0

Try it like this:

$scope.myHtml = '<button class="someclass" ng-click="clickme()">Button</button>';
Nikola
  • 14,888
  • 21
  • 101
  • 165
  • I did it like this, just took the wrong quotes in the Question.. sorry, But the Comment from @astrocrack seems to work :) – Juan Thomas Oct 20 '16 at 12:16