According to Angular it's not supposed to:

https://docs.angularjs.org/guide/directive

We would expect Angular to be able to bind to this, but when we check the 
console we see something likeError: Invalid value for attribute cx="{{cx}}". 
Because of the SVG DOM API's restrictions, you cannot simply writecx=
"{{cx}}".

With ng-attr-cx you can work around this problem.

> If an attribute with a binding is prefixed with the ngAttr prefix 
> (denormalized as ng-attr-) then during the binding it will be applied to 
> the corresponding unprefixed attribute. This allows you to bind to 
> attributes that would otherwise be eagerly processed by browsers (e.g. an 
> SVG element's circle[cx] attributes). When using ngAttr, the allOrNothing 
> flag 
> of $interpolate <https://docs.angularjs.org/api/ng/service/$interpolate> is 
> used, so if any expression in the interpolated string results in undefined, 
> the attribute is removed and not added to the element.



For example, we could fix the example above by instead writing:

<svg><circle ng-attr-cx="{{cx}}"></circle></svg>


That being said it looks like it still is appending that attribute in my 
code. 

<meta ng-attr-name="{{ meta.name }}" ng-attr-property="{{ meta.property }}" 
ng-attr-http-equiv="{{ meta['http-equiv'] }}" ng-attr-content="{{ 
meta.content }}" ng-attr-charset="{{ meta.charset }}" ng-attr-data-ng-repeat
="meta in metas" class="ng-scope" name="" property="og:description" 
http-equiv="" content="Bacon ipsum dolor sit amet leberkas fatback spare 
ribs, bresaola ribeye ground round beef ribs. Pig frankfurter porchetta 
pork" charset="">

As you said that, that's a problem? I haven't experienced problems as of 
yet though. Is it just a html validation issue?

Might be able to combine solutions here and use the service as well as the 
directive if that is a real big issue.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to