【发布时间】:2020-07-24 06:37:21
【问题描述】:
我正在尝试从 Contentful 获取资产、图像到我的 Angular 应用程序中。在网络日志中我得到图像时,它在我的 console.log 中一直显示undefined。知道为什么吗?
这是组件中的函数:
this.contentfulService.getContactImage()
.then(asset => this.pageImage)
.then(asset => console.log("Recieved Gallery Image", this.pageImage));
这里是服务:
//get Page Image
getContactImage() {
return this.cdaClient.getAsset('<asset ID>')
.then(asset => asset.fields.file.url);
}
【问题讨论】:
标签: javascript angular typescript contentful