我在资产文件夹中创建了一个 json 文件。下面是json
[
{
"userEmail": "IronMan@in.com",
"comment": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent placerat metus at mauris sagittis interdum adipiscing placerat metus.",
"commentDate": "08-01-2021 06:17:20 PM"
},
{
"userEmail": "CaptainAmerica@in.com",
"comment": "lLorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent placerat metus at mauris sagittis interdum. Cras lacinia posuere egestas.",
"commentDate": "08-01-2021 06:17:20 PM"
}
]
我需要插入的 HTML 看起来像这样
<!-- new chat -->
<div class="bx--col-lg-4 comment_section" style="position: fixed">
<!-- <div class="check">
<strong>Start the discussion</strong>
</div> -->
<div class="test">
<strong>Start the discussion</strong><br>
<strong>Title</strong>
<p>More clarity is required on submitted evidence</p>
<div>
<strong>Adam's comment</strong> <br>
<label class="bx--label">10 March 2019</label>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent placerat metus at mauris
sagittis interdum adipiscing placerat metus.</p>
</div>
<div>
<div>
<img src="https://avatarfiles.alphacoders.com/139/139523.jpg" class="img-rounded-cust">
<label class="bx--label">Time open: 1 day 3 hr 2 mins <br>
Last updated: 8 Oct 2018 7:29 PM</label>
<!-- <label class="bx--label">Last Updated</label> -->
</div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent placerat metus at mauris
sagittis interdum adipiscing placerat metus.</p>
</div>
<div>
<div>
<img src="https://avatarfiles.alphacoders.com/221/221555.jpg" class="img-rounded-cust">
<label class="bx--label">Time open: 1 day 3 hr 2 mins <br>
Last updated: 8 Oct 2018 7:29 PM</label>
<!-- <label class="bx--label">Last Updated</label> -->
</div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent placerat metus at mauris
sagittis interdum.</p>
</div>
<i-label class="bx--form-item"><label class="bx--label" for="i-label-3"
style="font-weight: 600 !important;"> Your Comment
</label>
<div class="bx--text-area__wrapper">
<!----><textarea aria-label="textarea" itextarea="" placeholder="Write your comments here"
rows="4" cols="50" class="bx--text-area" id="i-label-3"></textarea></div>
</i-label>
<br>
<button class="bx--btn bx--btn--primary" style="left: 60%;">Submit</button>
</div>
</div>
<!-- new chat ends -->
我是 Angular 的新手,有人可以通过展示如何在服务中调用此 json 并填充 HTML 来解释我。此外,此服务将位于此组件中还是位于应用程序文件夹中的任何位置。