Ionic 2 - Page reloaded after post request

Assaf

I'm trying to send data to server for saving. Everything works fine, but for some reason the page is reloaded right after the post request. This is the message I see in the console before the page is reloaded: "Dev server logger closed".

Here is the promise I use:

save(data){
    return new Promise((resolve) => {
      let headers = new Headers();
      headers.append('Content-Type', 'application/json');

      this.http.post('http://localhost:8080/api/postData', JSON.stringify(data), {headers: headers})
          .subscribe((res) => {
            resolve(res.json());
          });
    });
  }
Assaf

Found the problem, I saved the data on a file on the ionic project folder, while using ionic serve makes a restart for every file change.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Why page is reloaded after key.enter Angular?

How to redirect to previous page in Django after POST request

How to pass results from POST request to another page in Ionic and Angular

How to send post request in Ionic 2 for Node server run in localhost?

How to stay at the same page after submitting post request with Express?

Ajax post request after every reload of page

Django how update page after receiving POST request?

Laravel Redirect to Login page after Post Request

Update state after axios POST request instead of page refresh

POST request for login page

Google App Engine: Blank page after POST request

How to redirect to the same page after a POST request

jQuery-Ui loses functionality after reloaded to page

MultiValueDictKeyError generated in Django after POST request on login page

Unable to retrieve page 2 using POST request

I am wikipedia api call ,page is automatically reloaded after jquery ajax call.page content is displayed and then reloaded

Most appropriate way to redirect page after successful POST request in Django

POST request error in Ajax. Blank page after error

createImageBitmap only executing after page is reloaded

Django images not found in page view but was save after post request

How to prevent page from refreshing after JavaScript fetch post request?

Why page reloaded after the table is created by JavaScript

Stay On React Page After HTTP Post Request to Flask

Why my light theme resets after page is reloaded?

`POST` request to script page

How to save the status of the shopping cart after the page is reloaded?

Why is the page refreshed after javascript post request?

Nodejs Unable to render page after successful form post request

how to properly redirect to another page after post request in ionic angular?