Unfortunately, the way the site is setup that I need to retrieve data from, is that this data is spread across multiple sites (the exact same type of data and JSON return format) but they are at different URLs. They are classified by the URLs, so I do need to retain the URLs in order to further classify it throughout the app. I have the following service function where I am trying to pass a set of topics (which are then passed to the URL), retrieve the data and return a single observable. However, this is returning nothing:
getDataTopicItems(topicArray) {
return this.items = topicArray.forEach((topic, i, topicArray) => {
return this.http.get(this.baseUrl + topic + "/_api/Web/Lists/GetByTitle('What''s New')/items", this.options)
.map(res => res.json())
.map(items => items.d.results)
.do(data => console.log(data))
.concatMap(data => data)
}
)
}
I am subscribing to it in the template of the component where I am calling this function through an *ngFor plus an async pipe. What am I doing wrong?
Update: I also tried the following:
return this.http.get(this.baseUrl + topicArray[0] + this.policyOptions, this.options)
.map(res => res.json())
.map(items => this.policies = items.d.results)
.do(data => console.log(data))
.flatMap((policies) => topicArray.forEach((topic, i, topicArray) => {
if (i < 0) {
this.http.get(this.baseUrl + topic + this.policyOptions)
.map(res => res.json())
.map(items => this.policies = items.d.results)
.do(data => console.log(data))
}
}))