[英]Adding a click event to a dynamically created html element using angular2
[英]Adding multiple HTML Blocks in a single html file using angular2 and using their elements between each other
假設我有一個template.html和2個子模板(sub-template1.html和sub-template2.html),如何使它們在template.html中呈現,還使用類和ID以及其他DOM sub-template2.html中sub-template1.html中的相關變量。
例如:sub-template1.html有一個視頻,我需要在sub-template2.html中訪問它的當前時間
<!--template.html-->
<html>
<head>
<title></title
</head>
<body>
<!--- sub-template1.html -->
<br>
<!--- sub-template2.html -->
</body>
</html>
<!-- sub-template1.html -->
<div>
<video></video>
</div>
<!-- sub-template2.html -->
<div>
<h1> <!-- current time from video in sub-template1.html --></h1>
</div>
您需要創建服務以在兩個控制器之間傳遞數據。 請參考以下鏈接
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.