bo-id usage example
Opened this issue · 4 comments
Is there an example of how to use the "bo-id" tag? Can't seem to get this one to assign an id to my element. Thanks.
I was using this fiddle for something else, but I just added bo-id for you:
http://jsfiddle.net/NHVBW/3/
If you inspect the radio inputs, you'll see an "id" attribute has been added.
You the man! Thanks. Seems straight forward. I must have done something dumb before.
One thing interesting I found...
If $index is currently 1,
bo-id="'foo_'+$index+1" evaluates to "foo_11" even though 1 is not in single quotes.
bo-id="'chguide_'+($index+1)" evaluates to "foo_2" as expected.
Not sure if this is intended or not.
That is standard JavaScript behavior (intended). Bindonce is invoking Angular's $scope.$eval, and Angular is invoking JavaScript's eval().
When you concatenate a string and a number, the result is a string. In your example, you have string + number + number, and since there are no parentheses, order of operations dictates the first set to be concatenated first. So 'foo_' + 1 = 'foo_1'. Then, it does 'foo_1' + 1, which is the result you're seeing: 'foo_11'.