Answer the question
In order to leave comments, you need to log in
_this.posts.filter is not a function?
I did not make a big filter, but because of this, the following error appeared:
ERROR TypeError: _this.posts.filter is not a function
at SafeSubscriber.eval [as _next] (posts.component.ts:95)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:238)
at SafeSubscriber.next (Subscriber.js:185)
at Subscriber._next (Subscriber.js:125)
at Subscriber.next (Subscriber.js:89)
at DoSubscriber._next (do.js:88)
at DoSubscriber.Subscriber.next (Subscriber.js:89)
at MapSubscriber._next (map.js:83)
at MapSubscriber.Subscriber.next (Subscriber.js:89)
at RefCountSubscriber.Subscriber._next (Subscriber.js:125)
getPost(page: number) {
let filteredPosts;
if (this.servPost) {
this.servPost.getPosts(page).subscribe(
post => {
this.servPost = post;
this.filteredPosts = this.posts.filter(
(post) => post.name != null
);
}
);
}
}
Answer the question
In order to leave comments, you need to log in
this.posts is not an array. Why, see for yourself. There is nothing else in your passage about him.
Maybe you should have donethis.posts = post || [];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question