<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></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Base {
  static get parameters() {
     return [[Service]];
  }

  constructor(service) {
    this.service = service
  }
}

class Child extends Base {
  load() {
    return this.service.load()
  }
}

@Component(...)
class App {
  static get parameters() {
    return [[Child]]
  }

  constructor(service) {
     this.service = service
  }

  ngOnInit() {
    this.service.load()
  }
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">Base</span> <span class="pl-kos">{</span>
  <span class="pl-k">static</span> <span class="pl-k">get</span> <span class="pl-en">parameters</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
     <span class="pl-k">return</span> <span class="pl-kos">[</span><span class="pl-kos">[</span><span class="pl-v">Service</span><span class="pl-kos">]</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>

  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">service</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">service</span> <span class="pl-c1">=</span> <span class="pl-s1">service</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">class</span> <span class="pl-v">Child</span> <span class="pl-k">extends</span> <span class="pl-v">Base</span> <span class="pl-kos">{</span>
  <span class="pl-en">load</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">service</span><span class="pl-kos">.</span><span class="pl-en">load</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

@<span class="pl-v">Component</span><span class="pl-kos">(</span>...<span class="pl-kos">)</span>
<span class="pl-k">class</span> <span class="pl-v">App</span> <span class="pl-kos">{</span>
  <span class="pl-k">static</span> <span class="pl-k">get</span> <span class="pl-en">parameters</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-kos">[</span><span class="pl-kos">[</span><span class="pl-v">Child</span><span class="pl-kos">]</span><span class="pl-kos">]</span>
  <span class="pl-kos">}</span>

  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">service</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
     <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">service</span> <span class="pl-c1">=</span> <span class="pl-s1">service</span>
  <span class="pl-kos">}</span>

  <span class="pl-en">ngOnInit</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">service</span><span class="pl-kos">.</span><span class="pl-en">load</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Fails with <code class="notranslate">Cannot read property 'load' of undefined</code></p>
<p dir="auto"><strong>Expected behavior</strong><br>
<code class="notranslate">Service</code> is successfully injected into <code class="notranslate">Child</code> class and no error is thrown</p>
<p dir="auto"><strong>Minimal reproduction of the problem with instructions</strong><br>
Reproduction is in <code class="notranslate">Current behavior</code>. I did some investigation and found out that babel generate this for class without constructor:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function Child() {
  babelHelpers.classCallCheck(this, Child);
  return babelHelpers.possibleConstructorReturn(this, (Child.__proto__ || Object.getPrototypeOf(Child)).apply(this, arguments));
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-v">Child</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-s1">babelHelpers</span><span class="pl-kos">.</span><span class="pl-en">classCallCheck</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">,</span> <span class="pl-v">Child</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">return</span> <span class="pl-s1">babelHelpers</span><span class="pl-kos">.</span><span class="pl-en">possibleConstructorReturn</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-v">Child</span><span class="pl-kos">.</span><span class="pl-c1">__proto__</span> <span class="pl-c1">||</span> <span class="pl-v">Object</span><span class="pl-kos">.</span><span class="pl-en">getPrototypeOf</span><span class="pl-kos">(</span><span class="pl-v">Child</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">apply</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">,</span> <span class="pl-smi">arguments</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">And this is the regexp which checks whether class doesn't have own constructor:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{\s*(&quot;use strict&quot;;)?\s*(return\s+)?\S+\.apply\(this,\s*arguments\)/;"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-c1">DELEGATE_CTOR</span> <span class="pl-c1">=</span> <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">^</span>function<span class="pl-cce">\s</span><span class="pl-c1">+</span><span class="pl-cce">\S</span><span class="pl-c1">+</span><span class="pl-cce">\(</span><span class="pl-cce">\)</span><span class="pl-cce">\s</span><span class="pl-c1">*</span><span class="pl-kos">{</span><span class="pl-cce">\s</span><span class="pl-c1">*</span><span class="pl-kos">(</span>"use strict";<span class="pl-kos">)</span>?<span class="pl-cce">\s</span><span class="pl-c1">*</span><span class="pl-kos">(</span>return<span class="pl-cce">\s</span><span class="pl-c1">+</span><span class="pl-kos">)</span>?<span class="pl-cce">\S</span><span class="pl-c1">+</span><span class="pl-cce">\.</span>apply<span class="pl-cce">\(</span>this,<span class="pl-cce">\s</span><span class="pl-c1">*</span>arguments<span class="pl-cce">\)</span><span class="pl-c1">/</span></span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong><br>
It's useful when injected services from parent class can be injected into <code class="notranslate">Child</code> by default without additional coding</p>
<p dir="auto"><strong>Please tell us about your environment:</strong></p>

<ul dir="auto">
<li>
<p dir="auto"><strong>Angular version:</strong> 2.0.X<br>
2.4.8</p>
</li>
<li>
<p dir="auto"><strong>Browser:</strong> all</p>
</li>
<li>
<p dir="auto"><strong>Language:</strong> ES6/7</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="[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>
(note: this is the bug I wrongly reported in my first report <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="211959757" data-permission-text="Title is private" data-url="https://github.com/angular/angular/issues/14934" data-hovercard-type="issue" data-hovercard-url="/angular/angular/issues/14934/hovercard" href="https://github.com/angular/angular/issues/14934">#14934</a> , but now I have successed in reproducing it properly)<br>
My main module (foo in the example) contains a feature module (bar in the example), this feature module contains a service (ConfigurationService in the example) and a component (DisplayComponent in the example) which uses ConfigurationService. The component is exported by the bar module.<br>
In the foo module, we inherit from this component to create the CustomDisplay component.<br>
The application works fine, but the tests fail with the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Cannot read property 'getStuff' of undefined"><pre class="notranslate"><code class="notranslate">Cannot read property 'getStuff' of undefined
</code></pre></div>
<p dir="auto">It happens because the ConfigurationService is not injected in the component.</p>
<p dir="auto"><strong>Expected behavior</strong></p>

<p dir="auto">Tests should pass.</p>
<p dir="auto"><strong>Minimal reproduction of the problem with instructions</strong></p>

<p dir="auto">Here is an example generated with Angular CLI 1.0.0.rc1:<br>
<a href="https://github.com/ebrehault/ng-feature-module-example">https://github.com/ebrehault/ng-feature-module-example</a></p>
<p dir="auto">Just run:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ng test"><pre class="notranslate"><code class="notranslate">ng test
</code></pre></div>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong></p>

<p dir="auto">The motication is to be able to write tests :)</p>
<p dir="auto"><strong>Please tell us about your environment:</strong></p>

<p dir="auto">Ubuntu 16.10, npm 3.8.6</p>
<ul dir="auto">
<li><strong>Angular version:</strong> 2.4.9</li>
</ul>

<ul dir="auto">
<li><strong>Browser:</strong> Chrome (which is the browser used by karma)</li>
</ul>

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