Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extra space in directive attributes in html template

I noticed a weird thing when I was writing an angular directive. In the isolated scope of the directive, if I bind an attribute using myAttr: '@' to the parent scope variable with the same name, and then use that attribute in the html template, there will be an extra space trailing the attribute value. If the attribute is bound to the parent scope variable with a different name using myAttr: '@thatAttr', however, there is no extra space and the world is happy.

Please see this jsFiddle for a demonstration. As you can see, the css rules under div[bad=foo] is not applied because of the extra space, while div[good=bar] is perfectly fine.

The fiddle uses Angular 1.3 by the way. Does anyone know why this is the case?

like image 313
Xavier_Ex Avatar asked Dec 08 '25 09:12

Xavier_Ex


1 Answers

Known bug in Angular, likely will not be fixed

like image 143
przno Avatar answered Dec 11 '25 07:12

przno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!