<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[ X ] feature request"><pre class="notranslate"><code class="notranslate">[ X ] feature request
</code></pre></div>
<p dir="auto"><strong>Current behavior</strong></p>
<p dir="auto">The current error thrown when a service hasn't been defined in a module is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="zone.js:522 Unhandled Promise rejection: No provider for XService! ; Zone: &lt;root&gt; ; Task: Promise.then ; Value: 
Error
 Error
    at Error.ZoneAwareError (http://localhost:3000/polyfills.bundle.js:3588:33)
    at ZoneAwareError (http://localhost:3000/polyfills.bundle.js:3585:35)
    at injectionError (http://localhost:3000/vendor.bundle.js:3087:86)
    at noProviderError (http://localhost:3000/vendor.bundle.js:3125:12)
    at ReflectiveInjector_._throwOrNull (http://localhost:3000/vendor.bundle.js:4627:19)
    at ReflectiveInjector_._getByKeyDefault (http://localhost:3000/vendor.bundle.js:4666:25)
    at ReflectiveInjector_._getByKey (http://localhost:3000/vendor.bundle.js:4598:25)
    at ReflectiveInjector_.get (http://localhost:3000/vendor.bundle.js:4467:21)
    at AppModuleInjector.get (ng:///AppModule/module.ngfactory.js:180:107)
    at AppModuleInjector.getInternal (ng:///AppModule/module.ngfactory.js:295:53)
    at AppModuleInjector.NgModuleInjector.get (http://localhost:3000/vendor.bundle.js:5431:44)
    at resolveDep (http://localhost:3000/vendor.bundle.js:12836:45)
    at createClass (http://localhost:3000/vendor.bundle.js:12699:91)
    at createDirectiveInstance (http://localhost:3000/vendor.bundle.js:12530:37)
    at createViewNodes (http://localhost:3000/vendor.bundle.js:13879:49)"><pre class="notranslate"><code class="notranslate">zone.js:522 Unhandled Promise rejection: No provider for XService! ; Zone: &lt;root&gt; ; Task: Promise.then ; Value: 
Error
 Error
    at Error.ZoneAwareError (http://localhost:3000/polyfills.bundle.js:3588:33)
    at ZoneAwareError (http://localhost:3000/polyfills.bundle.js:3585:35)
    at injectionError (http://localhost:3000/vendor.bundle.js:3087:86)
    at noProviderError (http://localhost:3000/vendor.bundle.js:3125:12)
    at ReflectiveInjector_._throwOrNull (http://localhost:3000/vendor.bundle.js:4627:19)
    at ReflectiveInjector_._getByKeyDefault (http://localhost:3000/vendor.bundle.js:4666:25)
    at ReflectiveInjector_._getByKey (http://localhost:3000/vendor.bundle.js:4598:25)
    at ReflectiveInjector_.get (http://localhost:3000/vendor.bundle.js:4467:21)
    at AppModuleInjector.get (ng:///AppModule/module.ngfactory.js:180:107)
    at AppModuleInjector.getInternal (ng:///AppModule/module.ngfactory.js:295:53)
    at AppModuleInjector.NgModuleInjector.get (http://localhost:3000/vendor.bundle.js:5431:44)
    at resolveDep (http://localhost:3000/vendor.bundle.js:12836:45)
    at createClass (http://localhost:3000/vendor.bundle.js:12699:91)
    at createDirectiveInstance (http://localhost:3000/vendor.bundle.js:12530:37)
    at createViewNodes (http://localhost:3000/vendor.bundle.js:13879:49)
</code></pre></div>
<p dir="auto"><strong>Expected behavior</strong></p>
<p dir="auto">I'd like to know what class the error originated from. What class is trying to inject XService.</p>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong></p>
<p dir="auto">When a module has been installed via <code class="notranslate">npm install</code> it becomes annoying to debug. Which NgModule is throwing this error ?</p>
<ul dir="auto">
<li>
<p dir="auto"><strong>Angular version:</strong> 4.0.0</p>
</li>
<li>
<p dir="auto"><strong>Language:</strong> [TypeScript 2 ]</p>
</li>
</ul>
<p dir="auto"><strong>I'm submitting a ...</strong>  (check one with "x")</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[x] bug report =&gt; search github for a similar issue or PR before submitting"><pre class="notranslate"><code class="notranslate">[x] bug report =&gt; search github for a similar issue or PR before submitting
</code></pre></div>
<p dir="auto"><strong>Current behavior</strong><br>
Actually I have</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;span class=&quot;slds-form-element__help&quot; *ngIf=&quot;form.get('sapNumber').errors?.maxlength&quot; i18n&gt;Maximum de {{max8}} caractères autorisé.&lt;/span&gt;
&lt;span class=&quot;slds-form-element__help&quot; *ngIf=&quot;form.get('interfaceAccountNumber').errors?.maxlength&quot;  i18n&gt;Maximum de {{max15}} caractères autorisé.&lt;/span&gt;
&lt;span class=&quot;slds-form-element__help&quot; *ngIf=&quot;form.get('formDesignation').errors?.maxlength&quot; i18n&gt;Maximum de {{max20}} caractères autorisé.&lt;/span&gt;
&lt;span class=&quot;slds-form-element__help&quot; *ngIf=&quot;form.get('shortDesignation').errors?.maxlength&quot; i18n&gt;Maximum de {{max35}} caractères autorisé.&lt;/span&gt;"><pre class="notranslate"><code class="notranslate">&lt;span class="slds-form-element__help" *ngIf="form.get('sapNumber').errors?.maxlength" i18n&gt;Maximum de {{max8}} caractères autorisé.&lt;/span&gt;
&lt;span class="slds-form-element__help" *ngIf="form.get('interfaceAccountNumber').errors?.maxlength"  i18n&gt;Maximum de {{max15}} caractères autorisé.&lt;/span&gt;
&lt;span class="slds-form-element__help" *ngIf="form.get('formDesignation').errors?.maxlength" i18n&gt;Maximum de {{max20}} caractères autorisé.&lt;/span&gt;
&lt;span class="slds-form-element__help" *ngIf="form.get('shortDesignation').errors?.maxlength" i18n&gt;Maximum de {{max35}} caractères autorisé.&lt;/span&gt;
</code></pre></div>
<p dir="auto">and when I extract with <code class="notranslate">"./node_modules/.bin/ng-xi18n" --i18nFormat=xmb</code> I get 4 times same strings to translate with different ID in my <code class="notranslate">messages.xmb</code> file. All others strings aren't duplicated but this one is, why ?</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;msg id=&quot;4591664065864994257&quot;&gt;Maximum de &lt;ph name=&quot;INTERPOLATION&quot;&gt;&lt;ex&gt;INTERPOLATION&lt;/ex&gt;&lt;/ph&gt; caractères autorisé.&lt;/msg&gt;
&lt;msg id=&quot;3596670943450897156&quot;&gt;Maximum de &lt;ph name=&quot;INTERPOLATION&quot;&gt;&lt;ex&gt;INTERPOLATION&lt;/ex&gt;&lt;/ph&gt; caractères autorisé.&lt;/msg&gt;
&lt;msg id=&quot;27126914192147611&quot;&gt;Maximum de &lt;ph name=&quot;INTERPOLATION&quot;&gt;&lt;ex&gt;INTERPOLATION&lt;/ex&gt;&lt;/ph&gt; caractères autorisé.&lt;/msg&gt;
&lt;msg id=&quot;8495459888526831686&quot;&gt;Maximum de &lt;ph name=&quot;INTERPOLATION&quot;&gt;&lt;ex&gt;INTERPOLATION&lt;/ex&gt;&lt;/ph&gt; caractères autorisé.&lt;/msg&gt;"><pre class="notranslate"><code class="notranslate">&lt;msg id="4591664065864994257"&gt;Maximum de &lt;ph name="INTERPOLATION"&gt;&lt;ex&gt;INTERPOLATION&lt;/ex&gt;&lt;/ph&gt; caractères autorisé.&lt;/msg&gt;
&lt;msg id="3596670943450897156"&gt;Maximum de &lt;ph name="INTERPOLATION"&gt;&lt;ex&gt;INTERPOLATION&lt;/ex&gt;&lt;/ph&gt; caractères autorisé.&lt;/msg&gt;
&lt;msg id="27126914192147611"&gt;Maximum de &lt;ph name="INTERPOLATION"&gt;&lt;ex&gt;INTERPOLATION&lt;/ex&gt;&lt;/ph&gt; caractères autorisé.&lt;/msg&gt;
&lt;msg id="8495459888526831686"&gt;Maximum de &lt;ph name="INTERPOLATION"&gt;&lt;ex&gt;INTERPOLATION&lt;/ex&gt;&lt;/ph&gt; caractères autorisé.&lt;/msg&gt;
</code></pre></div>
<p dir="auto">N.B. I tried with <code class="notranslate">{{15}}</code> interpolation, I tried with <code class="notranslate">max15 : string = "15"</code> I tried with <code class="notranslate">max15 : number = 15</code> and same behavior !</p>
<p dir="auto"><strong>Expected behavior</strong><br>
Extract only one time this i18n string.</p>
<p dir="auto"><strong>Please tell us about your environment:</strong> webstorm 2017.1</p>
<ul dir="auto">
<li>
<p dir="auto"><strong>Angular version:</strong> 4.0.0</p>
</li>
<li>
<p dir="auto"><strong>Language:</strong> [ts 2.2.1]</p>
</li>
<li>
<p dir="auto"><strong>Node (for AoT issues):</strong> <code class="notranslate">node --version</code> =  v7.7.2</p>
</li>
</ul>