Hi i am a greenhorn in ionic, based on this picture, if i want to get data from database with the following URI or Params? is this call params or URI actually?
Api Get from PHP
www.searchenginejournal.com/api/author/taylor/books
i can get data if i type it straightforward
this.http.get(‘http://www.searchenginejournal.com/api/author/taylor/books’).subscribe(data=>{
this.test=data
})
but if
in my TS the following are declared
this.author
this.taylor
this.books
how do i format to make it dynamic?
(‘http://www.searchenginejournal.com/api/this.author + this.taylor + this.books’) or
(‘http://www.searchenginejournal.com/api/this.author + / + this.taylor + / + this.books’)
this.apiService.getShipping(this.a, this.b, this.c).subscribe(response => {
this.test = response; // for 1 object
console.log('this test from api', this.test)
});
i tried various methods but not successful,
i even tried from api service
api service
// Get shipping data
getbooks(id, item, data ){
return this.http
.get(this.base_path, + id + item + data)
.pipe(
retry(2),
catchError(this.handleError)
)
}
at TS
this.apiService.getbooks(this.a, this.b, this.c).subscribe(response => {
this.data = response; // for 1 object
console.log(‘this books from api’, this.data)
});
can anyone give me some directions where i went wrong? im still weak at observables etc. only know basic ionic.
thank u