Angular Http method not found

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Angular Http method not found



I've used this as core project for one of my project and I am stuck with it.

I trying to use the http method but it fails.
I've tried add the HttpClientModule to the app.module but still nothing.



The error that i get is :


app.ae014c5e7b696f87de83.bundle.js:107 ERROR TypeError:
Cannot read property 'method' of undefined



All I did in the app.component.ts file add




export class AppComponent extends BaseComponent implements OnInit {
constructor(
private readonly i18nStore: Store<I18NState>,
private readonly config: ConfigService,
private http: HttpClient,
@Inject(PLATFORM_ID) public platformId: Object
)
super();
// TODO: ngx-i18n-router
// private readonly i18nRouter: I18NRouterService)


ngOnInit(): void
this.i18nStore.dispatch(new Init(this.config.getSettings('i18n')));


createUserA(): void
this.http.get<any>('https://swapi.co/api/people/1')
.subscribe(data => console.log('data', data));




Bot get and post don't work.
I've imported :


import HttpClient from '@angular/common/http';




1 Answer
1



Add to your app.component.ts


contructor(private http : HttpClient)





already had that. I have uppdate the question so you can see
– Chris Tarasovs
Aug 12 at 16:02






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard