0

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.

1 Answer 1

2

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

this.http.get('http://localhost:49422/api/CustomerRegister').subscribe(result => this.result =result);
Sign up to request clarification or add additional context in comments.

2 Comments

sure, i m posting from mobile. hope it worked. mark if that helped
Hi, Now I am try to call the post method like below. this.http.post('localhost:51690/api/ZS/PostEmployee',{"EmployeeId": 166,"EmployeeName" :"'empname910", "EmployeeCity": "empcityw11"}).subscribe(test => console.log(test.json())); It's working fine while calling from POSTMAN. But not worked while calling from AngularJS... any suggestions ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.