05-04-2017 05:26 AM
Hello,
I created a custom tab and I added a webb app. The problem that I noticed is that the get methods works only one time. To make it work again I have to close Jabber and reopen it...
I don't have this problem with post methods..
A solution is to replace my get by post, but maybe some one has a better idea ?
05-09-2017 12:57 PM
Can you provide some additional detail on what you're attempting to do, any HTML/JS code, and the specific error/symptom..?
05-10-2017 01:17 AM
I want to get data from an API, here some relevant code:
Html:
<div *ngFor='let client of client' [routerLink]="['/detail', client.tel]">- {{client.firstName}}
{{client.lastName}}
</div>
JS (Angular2):
getClients(): Promise<Client[]> {
let url = 'http://localhost:8080/clients';
return this.http.get(url).toPromise().then(response => response.json().clients as Client[]);
}
The symptom is clear, the request does'nt go to the API more than one time per Jabber session...
If I replace the http.get(url) by http.post(url,{}) it works
05-10-2017 09:12 AM
Interesting...
Any chance your server is indicating via headers (i.e. Expires) that the URL can be cached?
Does this only occur with Angular2? Does substituting a more traditional XHTTP request work?
At the end of the day, Jabber just provides a container where the OS's web browser control is given a URL and space to render its output - it's possible that quirks of the system browser may be at play here
05-11-2017 01:30 AM
Thanks to your answer as was able to solve the issue.
The Url was cached, so in my server I added this line : response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
Thank you for your help !
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide