简体   繁体   中英

Dynamically set binding in aurelia

I want to achieve something like this in Aurelia:

pseudo code:

<template>
   <div repeat.for="column of columns">
     <input value.bind="company.[column]">
   </div>
</template>

I guess I would need to do something like this:

https://github.com/aurelia/framework/issues/102

But was wondering if there maybe is a simpler or more straightforward way?

As far as I can see, all you have to do is remove the dot between company and column:

<input value.bind="company[column]">

Here's a GistRun Example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM