Angular Property Binding

Another type of binding in Angular is property binding. In property binding, you use square brackets. It allows you to set the property of html elements within the template from data from the component class. Here is an example…

We can use the aforementioned component properties to set the width and height of a div in the html template. Here is an example…

Angular’s change detection will keep the properties in sync. This allows you to programatically change the properties of an html element.

Happy Coding!

Clay Hess

Share this post

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email
Skip to content