Append HTML Including ng-repeat directive

443 Views Asked by At

I'm trying to append an alert class that includes the angular ng-repeat directive:

ng-repeat="m in orders.messages"

The html appends fine, but the angular does not bind. It simply displays one alert with {{m}} as the contents. When I check Google Developer tools, it includes the directive as well. Also, when I put the static html instead of appending it, it repeats as expected.

var validationErrors = '<div class="alert alert-warning alert-dismissible" role="alert" ng-repeat="m in order.messages"> <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button><strong><span class="glyphicon glyphicon-warning-sign"></span> Warning!</strong> {{ m }} </div>';

$('#errorMessage').append(validationErrors);

Is there a way to append this so that the angular binds?

0

There are 0 best solutions below