내 변수를 해당 템플릿에 전달하고 렌더링 한 다음 결과 HTML을 문자열로 가져 오려고합니다.AngularJS 템플릿을 문자열로 변환하려면 어떻게해야합니까?
AngularJS에서 어떻게 할 수 있습니까? render_to_string()
function in Django과 유사한 기능이 있습니까?
문제는 내가 email.html
템플릿을 가지고 있다는 것입니다 (이메일을 레이아웃하는 것이 고통 스럽습니다). 변수를 채우고 싶습니다.
Let's는 email.html
의 내용이 같은 STH 것을 asume :
<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>
는 내가 객체가 있습니다
let messageBodyHtml = render('path_to_email.html', data)
data = {name: 'Foo', email: '[email protected]' }
이
그때에 STH 비슷한 기대를
결국이 messageBodyHtml
에는 다음 내용이 포함 된 문자열이 포함됩니다.
<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>
'$ compile' 서비스가 올바른 방향입니다! 고마워요! – alamasfu10