Angular · Junior · Question 10 of 75
What is the difference between src="{{ url }}" and [src]="url"?
- ✓Correct answer: Both set the
srcproperty; square brackets are property binding and also work with non-string values - 2
[src]sets the HTML attribute once, interpolation updates it - 3Interpolation only works for text nodes, not for attributes
Explanation
[property]="expr" binds a DOM or component property to an expression of any type, e.g. [disabled]="isSaving". Interpolation in an attribute is shorthand for a string property binding.