The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Jumy Elerossë (11) [Avatar] Offline
#1
I'm stuck in Chapter 8, particularly in the data services. The code compiles just fine, but nothing appears in the browser. I added the code for allowing CORS requests in express, but the problem persists. Checking the console of the browser, I can see the following error:

HomeListComponent_Host.ngfactory.js? [sm]:1 ERROR Error: StaticInjectorError(AppModule)[Loc8rDataService -> Http]: 
  StaticInjectorError(Platform: core)[Loc8rDataService -> Http]: 
    NullInjectorError: No provider for Http!
    at _NullInjector.get (core.js:994)
    at resolveToken (core.js:1292)
    at tryResolveToken (core.js:1234)
    at StaticInjector.get (core.js:1102)
    at resolveToken (core.js:1292)
    at tryResolveToken (core.js:1234)
    at StaticInjector.get (core.js:1102)
    at resolveNgModuleDep (core.js:10837)
    at NgModuleRef_.get (core.js:12070)
    at resolveDep (core.js:12560)


I can't go any further than page 296 with this problem... I appreciate any help.

Edit (solved):

Just edited app.module.ts and added the following:

- At the top, with the imports:
import { HttpModule } from '@angular/http';


- The imports under @NgModule needed the following:
 imports: [
    BrowserModule,
    HttpModule
  ],