Reputation: 29867
In my AngularJS app my controller sets customer info like this:
$scope.customers = [{'name': 'John', 'customerID': '1'}, {'name': 'Mike', 'customerID': '2'}];
How can I store the customer's ID in the custom attribute cid?:
<div ng-repeat="customer in customers" cid=""></div>
Upvotes: 1
Views: 34
Reputation: 5025
like this
<div ng-repeat="customer in customers" cid="{{customer.customerID}}"></div>
Upvotes: 0
Reputation: 7475
you need to do something like this:
<div ng-repeat="customer in customers" cid="{{customer.customerID}}"></div>
but the valid html way is to add "data-" before cid:
<div ng-repeat="customer in customers" data-cid="{{customer.customerID}}"></div>
Upvotes: 1