2017-08-31 1 views
0

enter image description here私はどこにでも見て、私が間違ってやっていたものを見つけることができなかったのHttp角度+のNode.jsのAPI

なしのプロバイダ。私は角度2を使用して、ノードサーバーAPIにGETリクエストを送信し、tradeという名前のコンポーネントにデータバインディングで表示される情報を取得しています。角度アプリを表示しようとすると、ウェブブラウザでエラーが発生します。私のnodejs appとangular2 appは、同じサーバー上で動作しています。

サービス: https://hastebin.com/ileqekites.js

コンポーネント:あなたはHttpModuleをあなたの角度のモジュールの一つに https://hastebin.com/agopopadus.cs

+1

可能な重複(https://stackoverflow.com/questions/33721276/angular-2-no-provider:ここ

は、一例として鉱山の一つであります-for-http) – Kuncevic

答えて

1

をインポートしているのですか? [HTTPの角度2いいえプロバイダ]の

import { NgModule } from '@angular/core'; 
import { BrowserModule } from '@angular/platform-browser'; 
import { HttpModule } from '@angular/http';    // <- HERE 
import { RouterModule } from '@angular/router'; 

import { AppComponent } from './app.component'; 
import { WelcomeComponent } from './home/welcome.component'; 

/* Feature Modules */ 
import { ProductModule } from './products/product.module'; 

@NgModule({ 
    imports: [ 
    BrowserModule, 
    HttpModule,           // <- HERE 
    RouterModule.forRoot([ 
     { path: 'welcome', component: WelcomeComponent }, 
     { path: '', redirectTo: 'welcome', pathMatch: 'full' }, 
     { path: '**', redirectTo: 'welcome', pathMatch: 'full' } 
    ]), 
    ProductModule 
    ], 
    declarations: [ 
    AppComponent, 
    WelcomeComponent 
    ], 
    bootstrap: [ AppComponent ] 
}) 
export class AppModule { } 
関連する問題