'Why my push-method is not working using Ionic?

I am working with ionic 3 and I have problems with an alert controller when I try to push an element in mi array. I do not what is wrong with my code, I think that I only need to receive the parameters and push it to complete the action but I only get a big error when I try to execute my code.

I'm so sorry, I know that my English is so bad.

CODE

  addPregunta() {
    const prompt = this.alertCtrl.create({
      title: "Login",
      message: "Enter a name for this new album you're so keen on adding",
      inputs: [
        {
          name: "title",
          placeholder: "Title"
        }
      ],
      buttons: [
        {
          text: "Cancel",
          handler: data => {
            console.log("Cancel clicked");
          }
        },
        {
          text: "Save",
          handler: data => {
            const preObj = {
              type: "radio",
              label: data.title
            };
            this.preguntas.push(preObj);
            this.changeData(data.title);
            this.mermaidStart();
          }
        }
      ]
    });
    prompt.present();
  }

ARRAY

preguntas: object[];

ERROR

enter image description here



Solution 1:[1]

You have declared the variable as an Array type but you did not initialize it so fails when you are trying to push into it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 General Grievance