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());
});
});
}
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.
Comments