<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
[ ] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question"><pre class="notranslate"><code class="notranslate">[x] bug report =&gt; search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
</code></pre></div>
<p dir="auto"><strong>Current behavior</strong><br>
When specifying a provider where <code class="notranslate">provide</code> is an abstract class and <code class="notranslate">useClass</code> is a concrete one, <code class="notranslate">ngOnDestroy</code> will never be called in the concrete class.</p>
<p dir="auto"><strong>Expected behavior</strong><br>
<code class="notranslate">ngOnDestroy</code> should be called.</p>
<p dir="auto"><strong>Minimal reproduction of the problem with instructions</strong><br>
<a href="https://plnkr.co/edit/eIs7pjvldhcFrMmaJ4IV?p=preview" rel="nofollow">https://plnkr.co/edit/eIs7pjvldhcFrMmaJ4IV?p=preview</a></p>
<ol dir="auto">
<li>Open the console.</li>
<li>Click the "Create Component" button one or many times</li>
<li>After a 2 second delay the component will be destroyed, but no console output will be seen.</li>
</ol>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong><br>
Providing abstract classes with concrete implementations that utilize <code class="notranslate">ngOnDestroy</code> to do cleanup.</p>
<p dir="auto"><strong>Please tell us about your environment:</strong></p>

<ul dir="auto">
<li><strong>Angular version:</strong> 2.4.8</li>
</ul>

<ul dir="auto">
<li><strong>Browser:</strong> Chrome 56.0.2924.87</li>
</ul>

<ul dir="auto">
<li>
<p dir="auto"><strong>Language:</strong> TypeScript 2.0</p>
</li>
<li>
<p dir="auto"><strong>Node (for AoT issues):</strong> <code class="notranslate">node --version</code> =</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="[ ] bug report =&gt; search github for a similar issue or PR before submitting
[x] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question"><pre class="notranslate"><code class="notranslate">[ ] bug report =&gt; search github for a similar issue or PR before submitting
[x] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
</code></pre></div>
<p dir="auto"><strong>Current behavior</strong><br>
When you provide a service using <code class="notranslate">useFactory</code>, <code class="notranslate">ngOnDestroy</code> will never be called.</p>
<p dir="auto"><strong>Expected behavior</strong><br>
Regardless of how you provide the service, <code class="notranslate">ngOnDestroy</code> should get called if it is a method on the service.</p>
<p dir="auto"><strong>Minimal reproduction of the problem with instructions</strong><br>
<a href="https://plnkr.co/edit/aUaz6ewyM3m5JorsAoCO?p=preview" rel="nofollow">https://plnkr.co/edit/aUaz6ewyM3m5JorsAoCO?p=preview</a></p>
<ol dir="auto">
<li>Open the console.</li>
<li>Click the "Create Component" button one or many times</li>
<li>After a 2 second delay the component will be destroyed, but no console output will be seen.</li>
<li>If you replace <code class="notranslate">useFactory</code> with <code class="notranslate">useClass</code> the problem goes away and you'll see output.</li>
</ol>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong><br>
There are many cases, main motivator is that this isn't intuitive.</p>
<p dir="auto"><strong>Please tell us about your environment:</strong></p>

<ul dir="auto">
<li><strong>Angular version:</strong> 2.4.8</li>
</ul>

<ul dir="auto">
<li><strong>Browser:</strong> Chrome 56.0.2924.87</li>
</ul>

<ul dir="auto">
<li>
<p dir="auto"><strong>Language:</strong> TypeScript 2.0</p>
</li>
<li>
<p dir="auto"><strong>Node (for AoT issues):</strong> <code class="notranslate">node --version</code> =</p>
</li>
</ul>