在我的AngularJS应用程序中,我的控制器设置了这样的客户信息:
$scope.customers = [{'name': 'John', 'customerID': '1'}, {'name': 'Mike', 'customerID': '2'}];
如何将客户的ID存储在自定义属性cid中?:
<div ng-repeat="customer in customers" cid=""></div>
答案 0 :(得分:1)
你需要做这样的事情:
<div ng-repeat="customer in customers" cid="{{customer.customerID}}"></div>
但有效的html方法是在cid之前添加“data-”:
<div ng-repeat="customer in customers" data-cid="{{customer.customerID}}"></div>
答案 1 :(得分:0)
<div ng-repeat="customer in customers" cid="{{customer.customerID}}"></div>