Mongodb ionic2模式错误无数据发送

Mongodb ionic2模式错误无数据发送,mongodb,mongoose,ionic2,Mongodb,Mongoose,Ionic2,当我像这样使用alertCtrl时,数据将进入数据库,它工作得很好 addTodo(){ let prompt = this.alertCtrl.create({ title: 'add', message: 'add', inputs: [ { name: 'title' }, { name: 'kan' }, {

当我像这样使用alertCtrl时,数据将进入数据库,它工作得很好

 addTodo(){

    let prompt = this.alertCtrl.create({
      title: 'add',
      message: 'add',
      inputs: [
        {
          name: 'title'
        },
        {
          name: 'kan'
        },
        {
          name: 'geos'
        },
        {
          name: 'geod'
        },
        {
          name: 'sahip'
        }

      ],
      buttons: [
        {
          text: 'İptal'
        },
        {
          text: 'Kaydet',
          handler: todo => {

                if(todo){

                    this.showLoader();

                    this.todoService.createTodo(todo).then((result) => {
                        this.loading.dismiss();
                        this.todos = result;
                        console.log("todo created");
                    }, (err) => {
                        this.loading.dismiss();
                        console.log("not allowed");
                    });

                }


          }
        }
      ]
    });

    prompt.present();

  }  
但当我尝试使用modal时,showloader正在运行,但createtodo不工作,没有数据进入数据库

 addTodo(){

        let modal = this.modalCtrl.create(KaneklePage);

        modal.onDidDismiss(todo => {

                    if(todo){

                        this.showLoader();

                        this.todoService.createTodo(todo).then((result) => {
                            this.loading.dismiss();
                            this.todos = result;
                            console.log("todo created");
                        }, (err) => {
                            this.loading.dismiss();
                            console.log("not allowed");
                        });

                    }

      });

        modal.present();


  }
这是modalpage中的代码

save(): void {

    let todo = {
      title: this.title,
      kan: this.kan,
      geos: this.geos,
      geod: this.geod,
      sahip: this.sahip
    };

    this.viewCtrl.dismiss(todo);

  }

您是否在
中获取数据?您在那里打印了todo吗?是的,我可以在OnDiddle中获取数据,我可以打印它,但当我尝试将其发送到db时,它不起作用。您是否收到任何错误?您可以在控制台中打印什么?很抱歉让您忙了,我在modalpage.html中使用了文本区域而不是输入区域。我将其更改为输入区域,现在它可以工作了。