如何解决“无法设置 null 属性(设置‘innerHTML’)”的问题
如何解决“无法设置 null 属性(设置 'innerHTML')” 问题?
我有一个 Angular 项目,我希望每个元素都有一个唯一的 id,因此我使用以下代码:
How can I solve a problem of "Cannot set properties of null (setting 'innerHTML')"?
I have an Angular project in which I want to have a unique id for every elements, so I use this code:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确定 idAct 正确吗?我不是 Angular 的日常用户,但在 HTML 中它只是 id。尝试用 id 替换 idAct。
还可以尝试使用 window.onload 事件:
Are you sure idAct is correct? I am not a daily Angular user, but in HTML it’s just id. Try replacing idAct with id.
Also try using the window.onload event: