我正在开发我的网络应用程序,但遇到了问题。
我有一个包含多个值的数组,我想在前端显示为列表或类似的东西。
app.component.ts
在这个函数中,我将字符串中的标签拆分为一个数组
splitTags() {
if (this.data.tags != null) {
var tag = this.data.tags.split(";")
console.log(tag)
}
}
ngOnInit() {
this.splitTags()
}
app.component.html
在这里我想在列表中显示标签
<li *ngFor="let tag in tags">
{{ tag }}
</li>
但是什么也没有出现,如果我在控制台中看到这些值也是如此。