0

Getting TypeError: Cannot read property 'push' of undefined in my Service when trying to save my Angular form. Error Snapshot

This is how i am trying to implement it in my article.service.ts

createArticle(data: ArticleDB) {
    this.articles.push(data);
}

tried Stackoverflow reply but it says Type 'undefined[]' is missing the following properties from type 'AngularFireList': query, valueChanges, snapshotChanges, stateChanges, and 4 more. Refrence image

4
  • this.articles is not an array, you should check this Commented Apr 24, 2019 at 9:05
  • set default value as [] i.e ( empty array ) Commented Apr 24, 2019 at 9:06
  • Okay, I guess I don't have the knowledge to answer your question. Deleting it! Commented Apr 24, 2019 at 9:58
  • hey @xyz thanks for your efforts... Commented Apr 24, 2019 at 10:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.