<p dir="auto">[ ] bug report =&gt; search github for a similar issue or PR before submitting<br>
[ ] feature request<br>
[x ] support request =&gt; Please do not submit support request here, instead see <a href="https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question">https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question</a></p>
<p dir="auto"><strong>Current behavior</strong><br>
docs:  <a href="https://angular.io/docs/ts/latest/cookbook/i18n.html" rel="nofollow">https://angular.io/docs/ts/latest/cookbook/i18n.html</a><br>
show only how to work with template via<br>
<code class="notranslate">&lt;p i18n&gt;foo&lt;/p&gt;</code></p>
<p dir="auto">would like the recommended way to work with strings when eval in code:</p>
<p dir="auto"><code class="notranslate">var foo = 'Hello world' </code></p>
<p dir="auto"><strong>Expected behavior</strong><br>
so maybe<br>
<code class="notranslate">var foo = '&lt;i18n&gt;Hello world' </code> ?</p>
<ul dir="auto">
<li><strong>Language:</strong> [all | TypeScript X.X | ES6/7 | ES5]<br>
all</li>
</ul>
<p dir="auto">Angular 2 Kitchen sink: <a href="http://ng2.javascriptninja.io" rel="nofollow">http://ng2.javascriptninja.io</a><br>
and source@ <a href="https://github.com/born2net/Angular-kitchen-sink">https://github.com/born2net/Angular-kitchen-sink</a><br>
Regards,</p>
<p dir="auto">Sean</p>
<p dir="auto"><strong>Steps to reproduce and a minimal demo of the problem</strong></p>
<p dir="auto">View hash_location_strategy:</p>
<div class="highlight highlight-source-dart notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="  void onPopState(UrlChangeListener fn) {
    this._platformLocation.onPopState(fn);
    this._platformLocation.onHashChange(fn);
  }"><pre class="notranslate">  <span class="pl-k">void</span> <span class="pl-en">onPopState</span>(<span class="pl-c1">UrlChangeListener</span> fn) {
    <span class="pl-c1">this</span>._platformLocation.<span class="pl-en">onPopState</span>(fn);
    <span class="pl-c1">this</span>._platformLocation.<span class="pl-en">onHashChange</span>(fn);
  }</pre></div>
<p dir="auto">Internal clients rely on manually dispatching <code class="notranslate">window.hashchange</code> events in order to have other libraries that rely on listening to hashchange manually know what the route is. Unfortunately, this seems to cause duplicate routing now.</p>
<p dir="auto">A workaround is to override <code class="notranslate">HashLocationStrategy</code> and replace:</p>
<div class="highlight highlight-source-dart notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@override
  void onPopState(UrlChangeListener fn) {
    // Instead of listening to hashChange + popState, just listen to hashChange.
    //
    // We manually invoke hashChange events which can cause duplicate routing.
    _platformLocation.onPopState(fn);
  }"><pre class="notranslate"><span class="pl-k">@override</span>
  <span class="pl-k">void</span> <span class="pl-en">onPopState</span>(<span class="pl-c1">UrlChangeListener</span> fn) {
    <span class="pl-c">// Instead of listening to hashChange + popState, just listen to hashChange.</span>
    <span class="pl-c">//</span>
    <span class="pl-c">// We manually invoke hashChange events which can cause duplicate routing.</span>
    _platformLocation.<span class="pl-en">onPopState</span>(fn);
  }</pre></div>
<p dir="auto">I'd prefer <em>not</em> to keep it like that long-term.</p>
<p dir="auto"><strong>Current behavior</strong></p>
<p dir="auto">Listens to both type of events.</p>
<p dir="auto"><strong>Expected/desired behavior</strong></p>
<p dir="auto">I'd imagine listen to just one?</p>