0

I am trying to get HTML to compile in a growl alert. Here is my code:

var html = '<h3>' + rejection.config.method + ' '+ rejection.config.url + '</h3>' +
   '<hr><div>' +
   (_.isObject(rejection.data) ? ('<pre>' + JSON.stringify(rejection.data, null, 2) + '</pre>') : rejection.data) +
   '</div>' + '<a ng-click="reportError($event)"><i class="fa fa-bullhorn hoverable"></i>  Report this error</a>';
   growl.addErrorMessage(html,
   {
       enableHtml: true
   });
   $compile(html)($scope);

On the page the HTML looks like:

<div ng-bind-html="message.text" ng-switch-when="true" class="ng-scope ng-binding"><h3>GET services/link</h3><hr><div>null</div><a><i class="fa fa-bullhorn hoverable"></i>  Report this error</a></div>

The html should have the directive that I appended: "<a ng-click="reportError($event)" and it is not being added. Any ideas?

user1200387
  • 625
  • 2
  • 13
  • 22
  • What exactly is the problem? – Ed_ Mar 28 '14 at 00:29
  • I just updated it hopefully to be more descriptive. I am trying to add a ng-click directive in the html i am putting in the growl alert. However nothing is being appended, so I tried to $compile it but that doesn't seem to work either. Not sure what to do at this point – user1200387 Mar 28 '14 at 00:46

0 Answers0