Christopher Piggott
2013-11-07 16:06:43 UTC
Hi,
I use a lot of templates (including pieces brought in with ng-include) that
include SVG. I've gotten into the habit of naming elements using the scope
ID as part of the name, because it allows me to distinguish them when there
are multiple instances of the template on the page (like widgets). Example:
<g id="tank{{$id}}"> ... </g>
Sometimes I do this in a definition:
<defs>
<g id="tank{{$id}}"> ... </g>
</defs>
As of 1.2, though, this doesn't work. Interpolation the id seems to work
fine without errors, but this fails:
<use x="200" y="150" xlink:href="#tank{{$id}}"/>
This fails because of the concatonation in the interpolation.
Error: [$interpolate:noconcat] Error while interpolating: #tank{{$id}}
Strict Contextual Escaping disallows interpolations that concatenate
multiple expressions when a trusted value is required.
See http://docs.angularjs.org/api/ng.$sce
It is not clear to me from the documentation how I am supposed to handle
this. What I really want to do is tell it that if it's an xlink:href
that's OK. What I do NOT want to do is to disable $sce entirely.
--Chris
I use a lot of templates (including pieces brought in with ng-include) that
include SVG. I've gotten into the habit of naming elements using the scope
ID as part of the name, because it allows me to distinguish them when there
are multiple instances of the template on the page (like widgets). Example:
<g id="tank{{$id}}"> ... </g>
Sometimes I do this in a definition:
<defs>
<g id="tank{{$id}}"> ... </g>
</defs>
As of 1.2, though, this doesn't work. Interpolation the id seems to work
fine without errors, but this fails:
<use x="200" y="150" xlink:href="#tank{{$id}}"/>
This fails because of the concatonation in the interpolation.
Error: [$interpolate:noconcat] Error while interpolating: #tank{{$id}}
Strict Contextual Escaping disallows interpolations that concatenate
multiple expressions when a trusted value is required.
See http://docs.angularjs.org/api/ng.$sce
It is not clear to me from the documentation how I am supposed to handle
this. What I really want to do is tell it that if it's an xlink:href
that's OK. What I do NOT want to do is to disable $sce entirely.
--Chris
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.