0

I have a directive which works perfectly. (it counts down form a number of seconds given as a attribute)

But when I put a piece of HTML-string containing that directive inside another HTML element it does not work; the directive does not compile. eg.

//does not work -> niels-timer-rirective does not compile
JS: $scope.binder = $sce.trustAsHtml('<span niels-timer seconds-to-go="123"></span>');
HTML: <span ng-bind-html="binder"></span>

See 'test 4' in this plunk: http://plnkr.co/edit/kwASEV8YXiNyktzdVQWB?p=preview

Of course this does work

HTML: <span niels-timer seconds-to-go="123"></span>

Can someone help me?!

Thx:)

  • http://stackoverflow.com/questions/20623118/rendering-directives-within-sce-trustashtml – tymeJV Feb 21 '15 at 22:56
  • won't work, as has been pointed out in multiple questions on this site. – Claies Feb 21 '15 at 22:58
  • possible duplicate of [AngularJS - Compiling dynamic HTML strings from database](http://stackoverflow.com/questions/18157305/angularjs-compiling-dynamic-html-strings-from-database) – New Dev Feb 21 '15 at 23:12

0 Answers0