<?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[Help with a global replace on a string in a directive]]></title><description><![CDATA[<p dir="auto">ng-change="Title1=dashboardchartType.replace('X', 'Y ');"  This works for the first instance .. does anyone know how to do same as global replace or even a multiple replacement?  I must be missing something cause I've tried every combination of  .replace(/'X'/g, 'Y')  ('/X/g', 'Y')   etc.  also .replace('W' | 'X', 'Y') does not evaluate.<br />
Thanks in advance.</p>
]]></description><link>https://forum.mango-os.com/topic/3490/help-with-a-global-replace-on-a-string-in-a-directive</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 13:17:54 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/3490.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 13 May 2018 20:01:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Help with a global replace on a string in a directive on Fri, 18 May 2018 14:59:39 GMT]]></title><description><![CDATA[<p dir="auto">Yes thanks guys for the explanation and link.</p>
]]></description><link>https://forum.mango-os.com/post/18498</link><guid isPermaLink="true">https://forum.mango-os.com/post/18498</guid><dc:creator><![CDATA[Phillip Weeks]]></dc:creator><pubDate>Fri, 18 May 2018 14:59:39 GMT</pubDate></item><item><title><![CDATA[Reply to Help with a global replace on a string in a directive on Mon, 14 May 2018 15:37:32 GMT]]></title><description><![CDATA[<p dir="auto">If you use a string as the first argument to the replace function it will only replace the first occurrence.<br />
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace" rel="nofollow ugc">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace</a></p>
<p dir="auto">I am pretty sure that a RegExp wont work in an AngularJS expression. AngularJS expressions are JavaScript like but not actually JavaScript - <a href="https://docs.angularjs.org/guide/expression" rel="nofollow ugc">https://docs.angularjs.org/guide/expression</a></p>
<p dir="auto">You should define a AngularJS filter or controller in a user module for something like this.</p>
]]></description><link>https://forum.mango-os.com/post/18430</link><guid isPermaLink="true">https://forum.mango-os.com/post/18430</guid><dc:creator><![CDATA[Jared Wiltshire]]></dc:creator><pubDate>Mon, 14 May 2018 15:37:32 GMT</pubDate></item><item><title><![CDATA[Reply to Help with a global replace on a string in a directive on Mon, 14 May 2018 14:05:08 GMT]]></title><description><![CDATA[<p dir="auto">Did you try <code>.replace(/X/g, 'Y')</code> ?</p>
]]></description><link>https://forum.mango-os.com/post/18427</link><guid isPermaLink="true">https://forum.mango-os.com/post/18427</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Mon, 14 May 2018 14:05:08 GMT</pubDate></item></channel></rss>