• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

I Like Kill Nerds

The blog of Australian Front End / Aurelia Javascript Developer & brewing aficionado Dwayne Charrington // Aurelia.io Core Team member.

  • Home
  • Aurelia 2
  • Aurelia 1
  • About
  • Aurelia 2 Consulting/Freelance Work

Inferred bindable properties in Aurelia 2

Aurelia 2 · January 11, 2021

About a year or so ago in the internal Aurelia core team chat, I raised an idea for inferred bindings. A lot of the time I find myself binding to values that have the same name as the bindable property.

The idea is simple, say I have a custom element that has a bindable property called products, I would then most likely do something like the following:

<product-list products.bind="products"></product-list>

It has always felt a bit redundant to me that I am specifying a property and then more often than not passing in a value of the same name. Well, after raising this again in the Aurelia core team chat, I was shocked to discover that this has been implemented.

You can now write the following:

<product-list products.bind></product-list>

The ="" part gets removed and Aurelia will look to your view-model for a property of the same name. While this might seem small, it makes the world of difference when you have custom elements with 4+ bindable properties, you save a lot of characters here.

Dwayne

Leave a Reply Cancel reply

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Paolo Carrasco
Paolo Carrasco
2 years ago

That’s an awesome addition to the framework! Keep it up the good work!

1

Primary Sidebar

Popular

  • I Joined Truth Social Using a VPN and Editing Some HTML to Bypass the Phone Verification
  • Testing Event Listeners In Jest (Without Using A Library)
  • How To Get The Hash of A File In Node.js
  • Thoughts on the Flipper Zero
  • Waiting for an Element to Exist With JavaScript
  • Handling Errors with the Fetch API
  • How To Get Last 4 Digits of A Credit Card Number in Javascript
  • How To Paginate An Array In Javascript
  • Wild Natural Deodorant Review
  • How To Install Eufy Security Cameras Without Drilling or Using Screws

Recent Comments

  • CJ on Microsoft Modern Wireless Headset Review
  • Dwayne on Microsoft Modern Wireless Headset Review
  • CJ on Microsoft Modern Wireless Headset Review
  • john on Microsoft Modern Wireless Headset Review
  • Dwayne on Why You Should Be Using globalThis Instead of Window In Your Javascript Code

Copyright © 2023 · Dwayne Charrington · Log in

wpDiscuz