93. Make Http Get Request and use RxJs Operators to transform the response in the Angular.
HTML-код
- Опубликовано: 27 сен 2020
- Hi Friends
In this video, we will see how to make the Http Get Request and use RxJS operators to transform the response in the Angular.
If you like my video, please subscribe to my channel.
RUclips Page: / leelawebdev
Facebook Page: / leelawebdev
Twitter Page: / leelanarsimha
Linkedin: / leela-narasimha-reddy-...
GitHub: github.com/leelanarasimha
#Angular #leelawebdev
🍺🍺
How to create firebase - API
Y to use spread operator
Spread operator is used to merge two objects and make single object. In the video we have two objects key and response. I have did video on spread operator in es6 playlist
getPosts() {
this.http
.get('httpclientmodule1-default-rtdb.firebaseio.com/posts.json')
.pipe(
map((response) => {
let posts = [];
for (let key in response) {
posts.push(response[key]);
}
return posts;
})
)
.subscribe((response) => {
console.log(response);
});
}
I am getting error on the line , push(response[key]):-- Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Object'.
No index signature with a parameter of type 'string' was found on type 'Object'.ts(7053)
write posts.push(response[key as keyof typeof response]) above to fix this typescript issue
@@ayushbhardwaj1109 excellent reply for key and response I was breaking my head from morning where I missed to watch your comments thankyou so much bro