Thymeleaf를 사용하여 SpringBoot 앱에서 호스팅되는 AngularJS 프로젝트에서 작업 중이며보기 및 라우팅을 통해 다른 웹 페이지에서 섹션 요소 만 가져 오려면 AngularJS가 필요합니다.
그러나 ThymeLeaf가 전체 HTML 페이지 대신 섹션 요소 만 제공하면서 개발할 때 웹 페이지를 자연스러운 템플릿으로 볼 수 있도록 만드는 방법을 알 수 없습니다.
따라서 서버에서는 다음과 같이 저장됩니다.
<html>
<title>Don't keep this </title>
<body>
<section>
Keep this
</section>
</body>
</html>
그러나 AngularJS가 페이지를 읽을 때 Thymeleaf는 다음과 같이 읽습니다.
<section>
Keep this
</section>
예, 이것은 조각으로 매우 간단합니다. html 파일이 다음과 같은 경우 :
<!-- whatever.html -->
<html>
<head>
<title>Don't keep this </title>
</head>
<body>
<section th:fragment="section">
Keep this
</section>
</body>
</html>
그리고 컨트롤러는 다음과 같습니다.
@RequestMapping(value = "whatever.html", method = RequestMethod.GET)
public String get() {
return "whatever :: section";
// Where the string 'whatever' resolves to the template, and section
// resolves to the text in th:fragment.
}
html을 반환합니다.
<section>
Keep this
</section>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다