Reputation: 9295
how can I call a controller function from html attribute. For example:
Controller function:
$scope.foo = function(id)
{
return id+1;
}
And here is the html:
<div ng-repeat obj in arr id="foo(obj.id)"></div>
This way I am getting ...id=foo(obj.id)
instead of ...id="2"
(if obj.id is equal 1).
Thanks!
Upvotes: 0
Views: 46
Reputation: 146
to call angular rendering you need to had {{ }}. Try this: id="{{foo(obj.id)}}"
Upvotes: 1