muuvmuuv
muuvmuuv

Reputation: 953

AngularJS render template into variable

I pull a html (mail template) from my database. The response is a valid HTML with doctype etc. So now I want to pass the template some variables and store that all into a variable to use it in a service that send a mail with node to some recipient.

How can I do that ?

Mail Template:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
<title>Mail Template</title>
</head>
<body>
  {{ variable }}
</body>
</html>

Upvotes: 1

Views: 72

Answers (1)

lucasnadalutti
lucasnadalutti

Reputation: 5948

I don't see a use for Angular in your goal. You're going to need the server to send the email, so why not do what you need in the template server-side as well?

You mentioned Node.js, so using this Node module should be perfect for what you need.

Upvotes: 1

Related Questions