Skip to content

Instantly share code, notes, and snippets.

@joeeames
Created October 5, 2016 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeeames/faca77557a431788e42940ea886669d4 to your computer and use it in GitHub Desktop.
Save joeeames/faca77557a431788e42940ea886669d4 to your computer and use it in GitHub Desktop.
dealing with circular dependencies with ngUpgrade and modules
import { NgModule, forwardRef } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, NgModel } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { UpgradeAdapter } from '@angular/upgrade';
import { NameParser } from './admin/nameParser';
import { ProfileComponent } from './profile/profile.component';
import { Location, LocationStrategy, HashLocationStrategy, PlatformLocation } from '@angular/common';
export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
@NgModule({
imports: [
BrowserModule,
FormsModule,
HttpModule
],
declarations: [
ProfileComponent
],
providers: [
NameParser,
Location,
{provide: LocationStrategy, useClass: HashLocationStrategy}
]
})
export class AppModule { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment