Who validates the property?


I’m trying to find the piece of code that is responsible for property value validation.

For example I have:

<h1 [style.color]="myColor">

And I bound myColor variable with input:

<input (input)="myColor = $event.target.value">

I expect change of color on input change.
But! Change happens only if I have valid color name in myColor otherwise it keeps an old value.

Plunker with example.

So my question is “How is responsible of property validation?”
I quickly looked though the source code but did not find an answer.


The browser just ignores invalid values.
There is no validation happening except sanitization which removes some security-sensitive values like urls In RC.1 some styles can't be added using binding syntax

Answered By – Günter Zöchbauer

Answer Checked By – Marilyn (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.