<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[SVG ma-selector change text within SVG]]></title><description><![CDATA[<p dir="auto">I am trying to change the text within an SVG image. I am able to target the text using <code>ma-selector</code> and I can change its style like its fill color. I tried changing the text using <code>ng-value</code> but that did not work. Any ideas?</p>
<pre><code>&lt;ma-svg ng-include="'/modules/mangoUI/web/dev/img/Bar_Gauge_Acc.svg'" style="width: 150px"&gt;
      &lt;div ma-selector="#Axis" style="fill: red;" ng-value="'string'"&gt;&lt;/div&gt;
&lt;/ma-svg&gt;
</code></pre>
]]></description><link>https://forum.mango-os.com/topic/3772/svg-ma-selector-change-text-within-svg</link><generator>RSS for Node</generator><lastBuildDate>Fri, 09 Oct 2026 16:49:54 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/3772.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 18 Sep 2018 19:43:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to SVG ma-selector change text within SVG on Tue, 18 Sep 2018 21:29:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/phildunlap" aria-label="Profile: phildunlap">@<bdi>phildunlap</bdi></a> Great that works! Thank you very much</p>
]]></description><link>https://forum.mango-os.com/post/19876</link><guid isPermaLink="true">https://forum.mango-os.com/post/19876</guid><dc:creator><![CDATA[jramirez]]></dc:creator><pubDate>Tue, 18 Sep 2018 21:29:11 GMT</pubDate></item><item><title><![CDATA[Reply to SVG ma-selector change text within SVG on Tue, 18 Sep 2018 21:26:00 GMT]]></title><description><![CDATA[<p dir="auto">The <code>ng-bind</code> as the property modified by the <code>ma-selector</code> is the critical part. If you assign something to that variable from whatever means it should work, such as</p>
<pre><code>&lt;ma-svg ng-init="textInput='Grumpy!'" ng-include="'/test.svg'" style="width: 150px"&gt;
      &lt;div ma-selector="#grump" ng-bind="textInput"&gt;&lt;/div&gt;
&lt;/ma-svg&gt;
</code></pre>
<p dir="auto">Edit: If you find yourself running into scope issues (although my examples should work), you may find Jared's tip at the end of this thread useful: <a href="https://forum.infiniteautomation.com/topic/3729/svg-ma-selector-and-watchlist/6" rel="nofollow ugc">https://forum.infiniteautomation.com/topic/3729/svg-ma-selector-and-watchlist/6</a></p>
]]></description><link>https://forum.mango-os.com/post/19875</link><guid isPermaLink="true">https://forum.mango-os.com/post/19875</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Tue, 18 Sep 2018 21:26:00 GMT</pubDate></item><item><title><![CDATA[Reply to SVG ma-selector change text within SVG on Tue, 18 Sep 2018 21:12:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/phildunlap" aria-label="Profile: phildunlap">@<bdi>phildunlap</bdi></a> Thanks that works, but what if I just wanted to change it to a constant value without needing to use the input tag??</p>
]]></description><link>https://forum.mango-os.com/post/19874</link><guid isPermaLink="true">https://forum.mango-os.com/post/19874</guid><dc:creator><![CDATA[jramirez]]></dc:creator><pubDate>Tue, 18 Sep 2018 21:12:24 GMT</pubDate></item><item><title><![CDATA[Reply to SVG ma-selector change text within SVG on Tue, 18 Sep 2018 21:27:23 GMT]]></title><description><![CDATA[<p dir="auto">Hi jramirez, welcome to the forum!</p>
<p dir="auto">I took the SVG for this answer from,</p>
<p dir="auto"><a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text" rel="nofollow ugc">https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text</a></p>
<p dir="auto">And modified it to (giving the Grumpy text element an ID),</p>
<pre><code>&lt;svg viewBox="0 0 240 80" xmlns="http://www.w3.org/2000/svg"&gt;
  &lt;style&gt;
    .small { font: italic 13px sans-serif; }
    .heavy { font: bold 30px sans-serif; }

    /* Note that the color of the text is set with the    *
     * fill property, the color property is for HTML only */
    .Rrrrr { font: italic 40px serif; fill: red; }
  &lt;/style&gt;

  &lt;text x="20" y="35" class="small"&gt;My&lt;/text&gt;
  &lt;text x="40" y="35" class="heavy"&gt;cat&lt;/text&gt;
  &lt;text x="55" y="55" class="small"&gt;is&lt;/text&gt;
  &lt;text id="grump" x="65" y="55" class="Rrrrr"&gt;&lt;/text&gt;
&lt;/svg&gt;
</code></pre>
<p dir="auto">which after placing it at Mango/web/test.svg enabled me to do,</p>
<pre><code>&lt;ma-svg ng-include="'/test.svg'" style="width: 150px"&gt;
      &lt;div ma-selector="#grump" ng-bind="textInput"&gt;&lt;/div&gt;
&lt;/ma-svg&gt;

&lt;input type="text" ng-model="textInput" ng-init="textInput='Grumpy!'"&gt;&lt;/input&gt;
</code></pre>
<p dir="auto">Which I believe is what you are seeking.</p>
]]></description><link>https://forum.mango-os.com/post/19868</link><guid isPermaLink="true">https://forum.mango-os.com/post/19868</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Tue, 18 Sep 2018 21:27:23 GMT</pubDate></item></channel></rss>