基本上,我试图填充一个选择框,但连接 first_name
列和 last_name
列中的值。
我想做的(不起作用):
<select ng-model="buyers" ng-options="b.id as (b.first_name + " " + b.last_name) for b in buyers"></select>
什么有效:
<select ng-model="buyers" ng-options="b.id as b.first_name for b in buyers"></select>
最佳答案
引号很重要。它不适用于双引号内的双引号或单引号内的单引号。
什么有效:
<select ng-model="buyers" ng-options='b.id as (b.first_name + " " + b.last_name) for b in buyers'></select>
关于angularjs - 是否可以连接 Angular ng-options 中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20101793/