<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>

<p dir="auto">After updating to Angular 4 code below throws errors (Cannot read property 'instance' of undefined). It was working without any problems before update:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export` const entity = new InjectionToken&lt;string&gt;('entity');

export class BaseComponent {
   protected entity&lt;string&gt;;
   constructor(injector: Injector) {
       ...
       this.entity = injector.get(entity)
   }
}

@Component({
   ...
   providers: [{provide: entity, useValue: 'whoCares'}]
})
export class InheritorComponent {
    constructor(injector: Injector) {
        super(injector)
    }
}"><pre class="notranslate"><code class="notranslate">export` const entity = new InjectionToken&lt;string&gt;('entity');

export class BaseComponent {
   protected entity&lt;string&gt;;
   constructor(injector: Injector) {
       ...
       this.entity = injector.get(entity)
   }
}

@Component({
   ...
   providers: [{provide: entity, useValue: 'whoCares'}]
})
export class InheritorComponent {
    constructor(injector: Injector) {
        super(injector)
    }
}
</code></pre></div>
<p dir="auto"><strong>Expected behavior</strong></p>
<p dir="auto">I excepted InheritorComponent to be initialized with provided data via token.</p>
<p dir="auto"><strong>Minimal reproduction of the problem with instructions</strong></p>

<p dir="auto">Here is working example:<br>
<a href="http://plnkr.co/edit/CQLX3D5WWjixnzV5zQgN?p=preview" rel="nofollow">http://plnkr.co/edit/CQLX3D5WWjixnzV5zQgN?p=preview</a><br>
Here is unwoking (to brake it uncomment 26 line of app.ts)<br>
<a href="http://plnkr.co/edit/5yeUn0j1VxASsAD0657n?p=preview" rel="nofollow">http://plnkr.co/edit/5yeUn0j1VxASsAD0657n?p=preview</a></p>
<p dir="auto">Code is similar. The only difference is angular version.</p>
<p dir="auto"><strong>Please tell us about your environment:</strong></p>

<ul dir="auto">
<li><strong>Angular version:</strong> 4.0.X</li>
</ul>

<ul dir="auto">
<li><strong>Browser:</strong> [all ]</li>
</ul>

<ul dir="auto">
<li>
<p dir="auto"><strong>Language:</strong> [TypeScript 2.2]</p>
</li>
<li>
<p dir="auto"><strong>Node (for AoT issues):</strong> <code class="notranslate">node --version</code> =   6.9.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
[ ] 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>

<p dir="auto">After updating from <code class="notranslate">4.0.0-rc.2</code> to <code class="notranslate">4.0.0</code> <code class="notranslate">Router</code> not injected as expected</p>
<p dir="auto"><strong>Expected behavior</strong></p>

<p dir="auto">Should be injected as expected</p>
<p dir="auto"><strong>Minimal reproduction of the problem with instructions</strong></p>

<p dir="auto">Plunker: <a href="http://plnkr.co/edit/ogCHjeYuCDM8vNLdwAFx?p=preview" rel="nofollow">http://plnkr.co/edit/ogCHjeYuCDM8vNLdwAFx?p=preview</a></p>
<p dir="auto">Update from <code class="notranslate">4.0.0-rc.2</code> to <code class="notranslate">4.0.0</code></p>
<p dir="auto"><code class="notranslate">ConfigService</code> provided in <code class="notranslate">AppModule</code> as <code class="notranslate">APP_INITIALIZER</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  providers: [
    ConfigService,
    {
      provide: APP_INITIALIZER,
      useFactory: configServiceFactory,
      deps: [ConfigService],
      multi: true
    }
  ],"><pre class="notranslate"><code class="notranslate">  providers: [
    ConfigService,
    {
      provide: APP_INITIALIZER,
      useFactory: configServiceFactory,
      deps: [ConfigService],
      multi: true
    }
  ],
</code></pre></div>
<p dir="auto"><code class="notranslate">ApiService</code> injected manually from <code class="notranslate">ConfigService</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Injectable()
export class ConfigService {

  private api: ApiService;

  public constructor(
    private injector: Injector
  ) {

    // Avoid cyclid dependencies, inject manually:
    this.api = injector.get(ApiService);
  }"><pre class="notranslate"><code class="notranslate">@Injectable()
export class ConfigService {

  private api: ApiService;

  public constructor(
    private injector: Injector
  ) {

    // Avoid cyclid dependencies, inject manually:
    this.api = injector.get(ApiService);
  }
</code></pre></div>
<p dir="auto"><code class="notranslate">router</code> is undefined when injected in <code class="notranslate">ApiService</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { Http, Headers, RequestOptionsArgs, Response } from '@angular/http';
import { Router } from '@angular/router';

@Injectable()
export class ApiService {

  constructor(
    private router: Router,
    private http: Http
  ) {

    console.log(router, 'router'); // undefined
    debugger;"><pre class="notranslate"><code class="notranslate">import { Http, Headers, RequestOptionsArgs, Response } from '@angular/http';
import { Router } from '@angular/router';

@Injectable()
export class ApiService {

  constructor(
    private router: Router,
    private http: Http
  ) {

    console.log(router, 'router'); // undefined
    debugger;
</code></pre></div>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong></p>

<p dir="auto"><strong>Please tell us about your environment:</strong></p>

<p dir="auto">@angular/cli: 1.0.0<br>
node: 7.4.0<br>
os: win32 x64<br>
@angular/animations: 4.0.0<br>
@angular/common: 4.0.0<br>
@angular/compiler: 4.0.0<br>
@angular/compiler-cli: 4.0.0<br>
@angular/core: 4.0.0<br>
@angular/forms: 4.0.0<br>
@angular/http: 4.0.0<br>
@angular/platform-browser: 4.0.0<br>
@angular/platform-browser-dynamic: 4.0.0<br>
@angular/platform-server: 4.0.0<br>
@angular/router: 4.0.0<br>
@angular/material: 2.0.0-beta.2<br>
@angular/flex-layout: 2.0.0-rc.1<br>
@angular/cli: 1.0.0<br>
@ngtools/webpack: 1.3.0</p>
<ul dir="auto">
<li><strong>Angular version:</strong> 4.0.0</li>
</ul>

<ul dir="auto">
<li>
<p dir="auto"><strong>Browser:</strong> all</p>
</li>
<li>
<p dir="auto"><strong>Language:</strong> TypeScript 2.2.1</p>
</li>
<li>
<p dir="auto"><strong>Node (for AoT issues):</strong> <code class="notranslate">node --version</code> =  7.4.0</p>
</li>
</ul>
<h3 dir="auto">The log given by the failure.</h3>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="core.es5.js:1085 ERROR TypeError: Cannot read property 'url' of undefined
    at CatchSubscriber.selector (api.service.ts:127)
    at CatchSubscriber.error (catch.js:104)
    at MapSubscriber.Subscriber._error (Subscriber.js:128)
    at MapSubscriber.Subscriber.error (Subscriber.js:102)
    at XMLHttpRequest.onLoad (http.es5.js:1210)
    at ZoneDelegate.invokeTask (zone.js:363)
    at Object.onInvokeTask (core.es5.js:4136)
    at ZoneDelegate.invokeTask (zone.js:362)
    at Zone.runTask (zone.js:166)
    at XMLHttpRequest.ZoneTask.invoke (zone.js:416)
defaultErrorLogger @ core.es5.js:1085
ErrorHandler.handleError @ core.es5.js:1145
next @ core.es5.js:4774
schedulerFn @ core.es5.js:3848
SafeSubscriber.__tryOrUnsub @ Subscriber.js:234
SafeSubscriber.next @ Subscriber.js:183
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ core.es5.js:3834
NgZone.triggerError @ core.es5.js:4205
onHandleError @ core.es5.js:4166
ZoneDelegate.handleError @ zone.js:334
Zone.runTask @ zone.js:169
ZoneTask.invoke @ zone.js:416
Navigated to http://localhost:4200/
core.es5.js:3053Template parse warnings:
The &lt;template&gt; element is deprecated. Use &lt;ng-template&gt; instead (&quot;[WARNING -&gt;]&lt;template&gt;&lt;div class=&quot;mat-autocomplete-panel&quot; role=&quot;listbox&quot; [id]=&quot;id&quot; [ngClass]=&quot;_getClassList()&quot; #p&quot;): ng:///MdAutocompleteModule/MdAutocomplete.html@0:0
Console.warn @ core.es5.js:3053
TemplateParser.parse @ compiler.es5.js:11508
JitCompiler._compileTemplate @ compiler.es5.js:25195
(anonymous) @ compiler.es5.js:25119
JitCompiler._compileComponents @ compiler.es5.js:25119
createResult @ compiler.es5.js:25004
ZoneDelegate.invoke @ zone.js:330
Zone.run @ zone.js:126
(anonymous) @ zone.js:679
ZoneDelegate.invokeTask @ zone.js:363
Zone.runTask @ zone.js:166
drainMicroTaskQueue @ zone.js:529
api.service.ts:31 undefined &quot;router&quot;"><pre class="notranslate"><code class="notranslate">core.es5.js:1085 ERROR TypeError: Cannot read property 'url' of undefined
    at CatchSubscriber.selector (api.service.ts:127)
    at CatchSubscriber.error (catch.js:104)
    at MapSubscriber.Subscriber._error (Subscriber.js:128)
    at MapSubscriber.Subscriber.error (Subscriber.js:102)
    at XMLHttpRequest.onLoad (http.es5.js:1210)
    at ZoneDelegate.invokeTask (zone.js:363)
    at Object.onInvokeTask (core.es5.js:4136)
    at ZoneDelegate.invokeTask (zone.js:362)
    at Zone.runTask (zone.js:166)
    at XMLHttpRequest.ZoneTask.invoke (zone.js:416)
defaultErrorLogger @ core.es5.js:1085
ErrorHandler.handleError @ core.es5.js:1145
next @ core.es5.js:4774
schedulerFn @ core.es5.js:3848
SafeSubscriber.__tryOrUnsub @ Subscriber.js:234
SafeSubscriber.next @ Subscriber.js:183
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ core.es5.js:3834
NgZone.triggerError @ core.es5.js:4205
onHandleError @ core.es5.js:4166
ZoneDelegate.handleError @ zone.js:334
Zone.runTask @ zone.js:169
ZoneTask.invoke @ zone.js:416
Navigated to http://localhost:4200/
core.es5.js:3053Template parse warnings:
The &lt;template&gt; element is deprecated. Use &lt;ng-template&gt; instead ("[WARNING -&gt;]&lt;template&gt;&lt;div class="mat-autocomplete-panel" role="listbox" [id]="id" [ngClass]="_getClassList()" #p"): ng:///MdAutocompleteModule/MdAutocomplete.html@0:0
Console.warn @ core.es5.js:3053
TemplateParser.parse @ compiler.es5.js:11508
JitCompiler._compileTemplate @ compiler.es5.js:25195
(anonymous) @ compiler.es5.js:25119
JitCompiler._compileComponents @ compiler.es5.js:25119
createResult @ compiler.es5.js:25004
ZoneDelegate.invoke @ zone.js:330
Zone.run @ zone.js:126
(anonymous) @ zone.js:679
ZoneDelegate.invokeTask @ zone.js:363
Zone.runTask @ zone.js:166
drainMicroTaskQueue @ zone.js:529
api.service.ts:31 undefined "router"
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1386622/24331329/793a21a0-123a-11e7-8f57-195271c76098.png"><img src="https://cloud.githubusercontent.com/assets/1386622/24331329/793a21a0-123a-11e7-8f57-195271c76098.png" alt="2017-03-26 15_39_04-mtcrm" style="max-width: 100%;"></a></p>