Here I have a complex data structure in an Angular4 application.
It is a directed multigraph parametrized with dictionaries both on nodes and on links. My angular components are working on this complex data model.
In Angular2.4, everything worked fine. Since we switched to Angular4, I get this into my DOM:
<g flareNode="" ng-reflect-model="{'id':'an-id-of-my-object'">
...which is generated from the following template snippet:
<svg:g flareNode [model]="item"></svg:g>
Note, model
is here simply a data member of my component. It has no (...should have no) specific Angular2 meaning. It is a part of the complex data structure behind my app.
My first impression is that Angular serializes the model
data member of the component class, gets its 30 first characters, and then puts this totally useless thingy into the DOM!
Am I right? What is this whole ng-reflect-model
in the DOM, what specific purpose has it in Angular4 what it didn't have in Angular2?
ng-reflect-model
attribute is for, and maybe that what could be the reason of this strange behavior (putting the first 30 characters of an object into the DOM as the value of an attribute). Any answer explaining what is the role of theng-reflect-model
inside the Angular framework is already acceptable.ng-reflect
attributes added to my components, but they were added in 2.4. If you create a plunker with DOM with such attributes, I'll take a lookng-reflect
is used. IMHO, there is no one on stackoverflow who can answer that question right now. I'm interesting to make some debugging and find the answer, as I write in-depth articles, but I need a demo. I spent an hour today trying to come up with an example, but couldn't getng-reflect
to be added.