Elavarasan M
Elavarasan M

Reputation: 192

Webapi get method not called from Angular app

I am new to Angular.

I have WebAPI controller, which contains get method to return some data.

It is working fine while launching it separately from browser.

While calling the same method from Angular app, the get method is not called in WebAPI controller.

Here is my code for calling get method.

this.http.get('http://localhost:49422/api/CustomerRegister');

Thanks in Advance.

Upvotes: 0

Views: 167

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222582

In angular , you need to subscribe to the http.get method

this.http.get('http://localhost:49422/api/CustomerRegister').subscribe(result => this.result =result);

Upvotes: 2

Related Questions