What is the difference between interpolation and property binding?
Model answer
Interpolation puts a value into text: <p>Hello {{ name }}</p>. Property binding sets a DOM or component property: <img [src]="imageUrl">. Interpolation always turns the value into a string. Property binding keeps the real type, so you can pass objects, numbers or booleans, such as [disabled]="isBusy".
Use interpolation for text and property binding when setting properties and inputs.
Learn this topic
Angular Tutorial: Beginner to Advanced .
Sign in to add your own answer.
More questions
- What are the parts of a component?
- What is data binding? Explain the four types.
- How do you pass data from a parent component to a child component?
- How does a child component send data to its parent?
- What is the component lifecycle? Describe the main hooks.
- What is the difference between the constructor and ngOnInit?