# Pushed data (alert prompt) into firebase

**URL:** <https://forum.ionicframework.com/t/pushed-data-alert-prompt-into-firebase/117788>\
**Category:** ionic-v3\
**Created:** [January 10, 2018, 8:37am UTC](https://forum.ionicframework.com/t/pushed-data-alert-prompt-into-firebase/117788 "2018-01-10T08:37:21Z")\
**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 10, 2018, 8:37am UTC](https://forum.ionicframework.com/t/pushed-data-alert-prompt-into-firebase/117788/1 "2018-01-10T08:37:21Z")

</div>

Hi, I wanted to push the data keyed in from the popup box to firebase for future retrieve.  
And I received this output error Firebase.push failed: first argument contains NaN in property 'quantity.quantity

This is my code,

home.ts

```auto
import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';

import { allItem } from './../../models/all-item/all-item.interface';

toggleValue: boolean = false;

  allItemRef2$: FirebaseListObservable<allItem[]>

   this.allItemRef2$ = this.database.list('Quantity');

activatePopup(toggleValue: true) {
    let prompt = this.alertCtrl.create({
      title: 'Quantity',
      message: "Enter quantity",
      inputs: [ 
        {
          name: 'quantity',
          type: 'number'
        },
      ],
      buttons: [
        {
          text: 'Cancel',
          handler: data => {
            console.log('Cancel clicked');
          }
        },
        {
          text: 'Confirm',
          handler: data => {
            console.log('Saved clicked');
            console.log(JSON.stringify(data));
            console.log(data.quantity);
          }
        }
      ]
    });

    if (this.toggleValue === true) {
      prompt.present();
    }
    else {
    }

```

home.html

```auto
 <ion-toggle [disabled]='false' [(ngModel)]="toggleValue" (ionChange)="activatePopup(true)" style='zoom:0.8;'></ion-toggle>

```

all-item.interface.ts

```auto
export interface allItem {
    quantity?: number;
}

```

I have tried done this code in home.ts however, it output was quantity is undefined.

```auto
      this.allItemRef2$.push({
        quantity: Number(this.allItem.quantity)
      });
  
      //reset Allitem
      this.allItem = {} as allItem;

```

Thankyou in advance.

---

<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:55pm UTC](https://forum.ionicframework.com/t/pushed-data-alert-prompt-into-firebase/117788/2 "2021-07-19T21:55:57Z")

</div>

Closed on July 19, 2021, 9:55pm UTC


