title: Angular 4 No provider for InjectionToken ORIGIN_URL
body: <p>I am using Angular 4 Server side Rendering and came across the issue where all service calls need an absolute URL. </p>
  
  <p>I am attempting to use "ORIGIN_URL" as was specified in my research. </p>
  
  <p>Here is my app.module:</p>
  
  <pre><code>import { NgModule, ErrorHandler, Inject, InjectionToken } from 
  
  '@angular/core';
  import { RouterModule } from '@angular/router';
  import { CommonModule } from '@angular/common';
  import { HttpModule } from '@angular/http';
  import { HttpClientModule, HttpClient } from '@angular/common/http';
  import { FormsModule, ReactiveFormsModule }   from '@angular/forms';
  
  import { RouteReuseStrategy } from '@angular/router';
  import { Location, LocationStrategy, PathLocationStrategy } from '@angular/common';
  import { Title }  from '@angular/platform-browser';
  
  import { LinkService } from './../shared/page/link.service';
  
  // Main App Root Component
  import { AppComponent } from './app.component';
  import { ROUTES } from './app.routes';
  // Component imports
  import { HeaderComponent } from './../global-components/header/header.component';
  import { FooterComponent } from './../global-components/footer/footer.component';
  import { LogInComponent } from './../global-components/login/log-in.component';
  
  // Provider (aka: "shared" | "services") imports
  import { LoggingHttpService } from './../shared/application-error-handler/logging.http.service';
  
  // i18n support
  import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
  import { TranslateHttpLoader } from '@ngx-translate/http-loader';
  
  import { ORIGIN_URL } from '@nguniversal/aspnetcore-engine';
  
  ...
  
  export function createTranslateLoader(http: HttpClient, baseHref) {
      // Temporary Azure hack
      if (baseHref === null &amp;&amp; typeof window !== 'undefined') {
          baseHref = window.location.origin;
      }
      // i18n files are in `wwwroot/assets/`
      return new TranslateHttpLoader(http, `${baseHref}/assets/i18n/`, '.json');
  }
  
  @NgModule({
      declarations: [
          AppComponent,
          // put shared components here
          HeaderComponent,
          FooterComponent,
          LogInComponent,
      ],
      imports: [
          CommonModule,
          HttpModule,
          RouterModule,
          FormsModule,
          RouterModule.forRoot(ROUTES),
          ReactiveFormsModule,
          TranslateModule.forRoot({
              loader: {
                  provide: TranslateLoader,
                  useFactory: (createTranslateLoader),
                  deps: [HttpClient, [ORIGIN_URL]]
              }
          })
          ...
      ],
      providers: [
          LinkService,
          // put shared services here
          LoggingHttpService,
         ...
          TranslateModule
      ],
      entryComponents: [
          ...
      ]
  })
  export class AppModule {}
  </code></pre>
  
  <p>I am attempting to inject this ORGIN_URL into a service to get the absolute URL. 
  Here is my service: </p>
  
  <pre><code>import { Injectable, Inject, Injector } from '@angular/core';
  import { HttpClient } from '@angular/common/http';
  import { Http, URLSearchParams } from '@angular/http';
  import { APP_BASE_HREF } from '@angular/common';
  import { ORIGIN_URL } from '@nguniversal/aspnetcore-engine';
  import { Observable } from 'rxjs/Observable';
  import { LogEntry } from './../models/Logging/LogEntry';
  
  @Injectable()
  export class LoggingHttpService {
      private baseUrl: string;
      constructor(private http: Http, private injector: Injector) {
          this.baseUrl = this.injector.get(ORIGIN_URL);
      }
  
      private static readonly LOG_INFORMATION_URL: string = '/api/logging/loginformation';
      private static readonly LOG_DEBUG_URL: string = '/api/logging/logdebug';
      private static readonly LOG_WARNING_URL: string = '/api/logging/logwarning';
      private static readonly LOG_ERROR_URL: string = '/api/logging/logerror';
  
      logInformation(logEntry: LogEntry) {
          return this.http.post(this.baseUrl + LoggingHttpService.LOG_INFORMATION_URL, logEntry);
      }
  
      logDebug(logEntry: LogEntry) {
          return this.http.post(this.baseUrl + LoggingHttpService.LOG_DEBUG_URL, logEntry);
      }
  
      logWarning(logEntry: LogEntry) {
          return this.http.post(this.baseUrl + LoggingHttpService.LOG_WARNING_URL, logEntry);
      }
  
      logError(logEntry: LogEntry) {
          return this.http.post(this.baseUrl + LoggingHttpService.LOG_ERROR_URL, logEntry);
      }
  
  }
  </code></pre>
  
  <p>I am getting the error Angular 4 No provider for InjectionToken ORIGIN_URL!</p>