NG0303:可以绑定到' ngforof'

发布于 2025-02-01 18:27:23 字数 402 浏览 3 评论 0原文

我知道有很多有关特定错误的信息,但是我从字面上做了他们的建议,我仍然缺少一些东西。 因此,我的组件内有一个数组,我试图通过 *ngfor在我的component.html中显示它。 因此,我在标题中说了这个错误,但是我试图创建一个简单的字符串和循环循环,并且实际上起作用。 在以下照片中,我能够看到我能够在.ts和.html中循环的评论阵列,并且在两者中也没有工作(成员:[Member []),这是两个事先的!

编辑:comp.html显示“让成员的成员”,但实际上是成员

https://i.sstatic.net/dww4n.jpg

Guys I know theres plenty of info about the specific error, but I literally did what they suggest and Im still missing something.
So I have an array inside my component.ts and Im trying to display it via *ngfor inside my component.html..
so Im getting that error said in the title, but I tried to create a simple array of string and loop through it and it actually worked.
in the following photos ull be able to see the commented array I was able to loop through in both .ts and .html and the one that didnt work (member: Member[]) also in both, thanks in advance!!

edit: comp.html shows 'let member of member' but its actually of members

https://i.sstatic.net/DWW4n.jpg

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光与爱终年不遇 2025-02-08 18:27:23

如果是root模块(AppModule),则将BrowserModule添加到NGMODULE中的导入中,否则CommonModule。

import { BrowserModule } from '@angular/platform-browser'

@NgModule({
  imports: [BrowserModule],
})

Add BrowserModule to imports in NgModule if it's the root module (AppModule), otherwise the CommonModule.

import { BrowserModule } from '@angular/platform-browser'

@NgModule({
  imports: [BrowserModule],
})
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文