i have ApiRest built with laravel that have the following code in .htaccess
# Enable Cors Policy...
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"
Header add Access-Control-Allow-Methods "*"
Header add Access-Control-Allow-Credentials "true"
All api corretcly works.
With ionic 4 i implemented a service called api.service that work with HttpClient, like the following code
@Injectable({
providedIn: 'root'
})
export class ApiService {
url = 'https://testurl/api';
constructor(private http: HttpClient) { }
public getInfo(): Observable<Model[]> {
return this.http.get<Model[]>(this.url+'/info')
}
}
All calls works well, except one that doesn t work in new page opened with
this.router.navigate(['info/'+parameter]);
I just tryed to find solution in stackoverflow and google unsuccessful.
Here is it also an example call:
this.apiService.getInfo().subscribe((data) => {
}, (err) => {
this.toastService.showToast("Error");
});
I also tryed to remove NavigationExtras but but it still doesn't work.
Any Solution?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire