# Firebase push fail

**URL:** <https://forum.ionicframework.com/t/firebase-push-fail/117538>\
**Category:** ionic-v3\
**Created:** [January 8, 2018, 7:41am UTC](https://forum.ionicframework.com/t/firebase-push-fail/117538 "2018-01-08T07:41:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobertLow](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@RobertLow](https://forum.ionicframework.com/u/RobertLow)\
**Post date:** [January 8, 2018, 7:41am UTC](https://forum.ionicframework.com/t/firebase-push-fail/117538/1 "2018-01-08T07:41:04Z")

</div>

Hello helpers, I am pushing data into Firebase but I am having this error. What have I missed out or done wrong?  
Earlier I am able to push data into it but not on this page.  
Much appreciation.  
I would like to push this value into Firebase for later retriever.

Error message

```auto
ERROR Error: Firebase.push failed: first argument contains undefined in property 'all-item.anArray'.

```

My html code

```auto
<ion-content>
    <ion-item>
      <ion-label>Number of item</ion-label>
    <ion-input type="number" [(ngModel)]="item" ></ion-input>
  </ion-item>

  <button ion-button (click)="Add(item)">Create Field</button>

  <button ion-button (click)="delete(item)">Remove Field</button>
  
    <ion-item *ngFor="let att of anArray; let idx = index">
        <ion-label color="primary" floating>{{att.label}}{{idx+1}}</ion-label>
        <ion-input type="text" [(ngModel)]="anArray[idx].value"></ion-input>
    </ion-item>

```

My ts code

```auto
export class HomePage {

  anArray: any = [];

  item: any;
  btn: any
  data: any;

  allItem = {} as allItem;

  allItemRef$: FirebaseListObservable<allItem[]>

  constructor(public navCtrl: NavController, public navParams: NavParams, private database: AngularFireDatabase) {

    this.allItemRef$ = this.database.list('all-item');

    console.log('this.anArray', this.anArray);
    this.btn = false;
    this.data = false;
  }

  Add(key) {
    console.log('key', key)
    for (let i = 0; i < key; i++) {
      this.anArray.push({ label: 'item', value: '' });
    }
    console.log('show current', this.anArray);
    this.btn = true;
  }

  delete(key) {
    console.log('key', key)
    for (let i = 0; i < key; i++) {
      this.anArray.pop({ label: 'item', value: '' });
    }
    console.log('show current', this.anArray);
    this.btn = true;
  }

  submit(allItem: allItem) {
    this.allItemRef$.push({
      anArray: this.allItem.anArray,
    });

    this.allItem = {} as allItem;

    this.navCtrl.push('NextPage');
  }

```

My model class

```auto
export interface allItem {
    anArray: string;
}

```

Thank you for all help.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:56pm UTC](https://forum.ionicframework.com/t/firebase-push-fail/117538/2 "2021-07-19T21:56:09Z")

</div>


