Answer the question
In order to leave comments, you need to log in
How to add markup with ng-repeat?
Good afternoon.
For a blog, I store the content of the post in an object:
vm.postArr = [{
title:"newPosr",
data:'January 1, 2014',
author:'Mark',
body:'<p>This blog post.</p>'
}]
Answer the question
In order to leave comments, you need to log in
Problem solved.
I create a directive:
.directive('compile', function($compile){
return function(scope, element, attr){
const body = angular.element(attr.compile)
const compileFunc = $compile(body);
compileFunc(scope)
element.append(body)
}
})
<p compile = '{{post.body}}' ></p>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question