Angular API和数据显示
我正在尝试在Angular组件的HTML部分访问我以粗体标记的字段。 我从API调用中获取它们,但我无法导航到它们。
我只能到达product.sgation。我在html中得到一个对象/objetc ....
我刚刚开始使用API的API开始冒险。
我需要显示粗体**数据。
{
"id": 1,
"name": "test api",
"categories": [
{
"id": 12,
"name": "test-sub-api",
"products": [
{
"id": "33",
"**thumbnail**": "https:urlimagetest",
"**display_name**": "ABCD",
"instructions": {
"**price**": "pricetest",
"**format**": "formattest"
}
}
]
}
]
}
我如何束缚它?我尝试使用{{myval.name}},但我不知道如何显示粗体数据
I am trying to access in the html part of my angular component to the fields that I mark in bold.
I get them from an api call, but I am not able to navigate to them.
I only get to product.categories and I get an object/objetc in my html....
i am just starting my adventure with api in angular.
i need to show the bold ** data.
{
"id": 1,
"name": "test api",
"categories": [
{
"id": 12,
"name": "test-sub-api",
"products": [
{
"id": "33",
"**thumbnail**": "https:urlimagetest",
"**display_name**": "ABCD",
"instructions": {
"**price**": "pricetest",
"**format**": "formattest"
}
}
]
}
]
}
how i can bind that?? i try with {{myVal.name}}, that works, but i don't know how show the bold data
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用
*ngfor
提示:如果要在HTML模板中打印对象进行调试,请使用
JSON
管道:如果没有管道,您将获得
[对象对象]
You need to loop through the arrays with
*ngFor
Tip: If you want to print an object in the html template for debugging, use the
json
pipe:If you do it without the pipe you will get
[Object object]