@ngrx/effects
v4.0.5をAngular v4.4.4で使用しています。ngrx EffectsModuleでHttpサービスが定義されていません
にEffectsModule
をインポートすると、Httpサービスが定義されなくなります。
いくつかのコード:
// app.module.ts
import { BrowserModule, Title } from '@angular/platform-browser';
...
import { HttpModule, Http } from '@angular/http';
...
import { EffectsModule } from '@ngrx/effects';
import { AuthenticationModule } from './authentication/authentication.module';
import { MyEffects } from './myEffects.ts'
...
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
HttpModule,
...
AuthenticationModule,
StoreModule.forRoot(reducers),
EffectsModule.forRoot([MyEffects])
]
...
})
export class AppModule { }
MyEffects
は、認証機能にどのような方法で関連していないことに注意してください。
私は私のアプリで使用できる最初の事、ボタンで記号を使用すると、私はエラーメッセージが表示されました(これはthis.http.post(...
そしてthis.http
そのHTTPインスタンスを呼び出しAuthenticationService.signInが、定義されていない呼び出し、デバッガを経由してそれに見て、それは未定義た - this
が未定義ではないと私はEffectsModule.forRoot([MyEffects])
をコメントアウト場合は未定義であるhttp
プロパティ)
を持っている、HTTPサービス「が再び表示されます」と作品にサインインします。
MyEffects
は、認証機能とは何ら関係していません。