简体   繁体   English

在aurelia中动态设置绑定

[英]Dynamically set binding in aurelia

I want to achieve something like this in Aurelia: 我想要在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 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 这是一个GistRun示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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