I want to pass my variables into that template, let it render, and then get the resulting HTML as a string.
How can I do that in AngularJS? Is there a similar function to the render_to_string() function in Django?
The issue is that I have an email.html template (you know, layouting emails is painful) and I would like to populate it with variables.
Let´s asume that the content of the email.html is sth like:
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>Hello {{ name }}</h1>
<div>We will contact you soon in this email address: {{ email }}</div>
</body>
</html>
And I have an object: data = {name: 'Foo', email: '[email protected]' }
I would then expect sth similar to:
let messageBodyHtml = render('path_to_email.html', data)
And in the end, that messageBodyHtml would contain a string with this content:
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>Hello Foo</h1>
<div>We will contact you soon in this email address: [email protected]</div>
</body>
</html>