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

Tanvir Anowar picture Tanvir Anowar · Aug 3, 2018 · Viewed 8.7k times · Source

I'm new with Angular 6 . I have assigned public property at component.js file and the values are not rendering in the component.html file. I have attached chrome log , component.ts and component.html file.

It would be highly appreciated if you can let me know where I'm doing wrong.

html file script file Chrome colsole log

Answer

Amit Chigadani picture Amit Chigadani · Aug 3, 2018

Your error says it so clearly that you are doing something wrong with {{m.name}}. It is trying to add it as an attribute because you mention it inside the attribute section which is invalid.

Move it to the content section i.e between the opening and closing tags.

Change it this way :

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