简体   繁体   English

Angular 6 - ERROR DOMException:无法在'Element'上执行'setAttribute':

[英]Angular 6 - ERROR DOMException: Failed to execute 'setAttribute' on 'Element':

I'm new with Angular 6 . 我是Angular 6的新手。 I have assigned public property at component.js file and the values are not rendering in the component.html file. 我在component.js文件中分配了公共属性,并且这些值未在component.html文件中呈现。 I have attached chrome log , component.ts and component.html file. 我附加了chrome log,component.ts和component.html文件。

It would be highly appreciated if you can let me know where I'm doing wrong. 如果你能让我知道我做错了什么,我们将不胜感激。

html文件 脚本文件 Chrome colsole日志

Your error says it so clearly that you are doing something wrong with {{m.name}} . 您的错误清楚地表明您正在对{{m.name}}做错事。 It is trying to add it as an attribute because you mention it inside the attribute section which is invalid. 它试图将其添加为属性,因为您在attribute部分中提及它是无效的。

Move it to the content section ie between the opening and closing tags. 将其移至content部分,即开始和结束标签之间。

Change it this way : 这样改变:

<option *ngFor="let m for data" value="{{m.id}}">{{m.name}}</option> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误 DOMException:无法在“元素”上执行“setAttribute”:“{{”不是有效的属性名称 - ERROR DOMException: Failed to execute 'setAttribute' on 'Element': '{{' is not a valid attribute name 由于错误,我的 Vue 应用程序无法安装:未捕获的 DOMException:无法在“元素”上执行“setAttribute”:“)”不是有效的属性名称 - My Vue app won't mount because of an error: Uncaught DOMException: Failed to execute 'setAttribute' on 'Element': ')' is not a valid attribute name DOMException 无法在“Element”和“releasePointerCapture”上执行“setPointerCapture” - DOMException failed to execute 'setPointerCapture' on 'Element' and 'releasePointerCapture' 为什么随机出现一个错误说 Uncaught DOMException: Failed to execute 'querySelector' on 'Element': '' is not a valid selector - Why is there an error that occurs randomly saying Uncaught DOMException: Failed to execute 'querySelector' on 'Element': '' is not a valid selector 我收到以下错误... [Uncaught InvalidCharacterError:无法在&#39;Element&#39;上执行&#39;setAttribute&#39;:&#39;0&#39;不是有效的属性名称 - I got the following error… [Uncaught InvalidCharacterError: Failed to execute 'setAttribute' on 'Element': '0' is not a valid attribute name &#39;DOMException: 使用 &#39;option:selected&#39; 选择器时,无法在 &#39;Element&#39; 上执行 &#39;querySelectorAll&#39; - 'DOMException: Failed to execute 'querySelectorAll' on 'Element' when using an 'option:selected' selector DOMException:无法在“IDBObjectStore”上执行“getAll”:事务在 angular 中不活动 - DOMException: Failed to execute 'getAll' on 'IDBObjectStore': The transaction is not active in angular 无法在“元素”上执行“setAttribute”:“roman”;“”不是有效的属性名称 - Failed to execute 'setAttribute' on 'Element': 'roman";"' is not a valid attribute name 无法在“元素”上执行“setAttribute”:“[编辑器]?” 不是有效的属性名称 - Failed to execute 'setAttribute' on 'Element': '[editor]?' is not a valid attribute name DOMException:无法在“文档”上执行“ querySelector”: - DOMException: Failed to execute 'querySelector' on 'Document':
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM