Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48979

User interaction results in error on ModalController

$
0
0

Hi there, I’m working on an Angular 7 project that utilizes Ionic v4 and there’s one page navigation from home page that has been throwing out the following error for a long time:


This navigation from home page to live newsletter page (aka the one that’s spewing out this error) is fairly straightforward.
liveNewsletter() {
	this.router.navigate(['live-newsletter']);     
}

And in the lve newsletter page ts there are a few methods that take care of modal creation, one of them, for example, looks like this:

  // 新增分配整改措施
  async addCorrectiveAction() {
    // 设置标题
    document.getElementsByTagName('title').item(0).innerText = '添加隐患';
    if (dd.env.platform !== 'notInDingTalk') {
      dd.biz.navigation.setTitle({
        title: '添加隐患', // 钉钉设置导航栏标题
      });
    }

    if (!this.form.value.physical_structure_id) { // 如果没有选择被检查工厂则不允许分配整改措施,并提示
      this.appService.toastTip('select_physical_first', true);
      return;
    }
    const modal = await this.modalCtrl.create({
      component: TaskchkAssignModalComponent,
      componentProps: {
        deviation_id: Number(this.form.controls.physical_structure_id.value),
        isLiveNewsLetter: true,
        findId: this.isTaskCenter ? this.findingDataId : null,
      },
      showBackdrop: true,
      backdropDismiss: true
    });
    modal.onDidDismiss().then(res => {
      // 设置标题
      document.getElementsByTagName('title').item(0).innerText = '隐患上报';
      if (dd.env.platform !== 'notInDingTalk') {
        dd.biz.navigation.setTitle({
          title: '隐患上报', // 钉钉设置导航栏标题
        });
      }

      if (res.data && res.data !== 'cancel' && res.data !== 'delete') {
        this.actions.push(res.data);
      }
    });
    return await modal.present();
  }

Everything looks fine and indeed it was fine for some time, and then one day it broke out of nowhere. What confuses me the most, besides the error message, is that it seems to be an issue with how ModalController is configured but I have compared this configuration of this page to another page in which opens fine and modals in that page is also working. Besides that, on another page that also utilizes ModalController when I click a button on that page that has nothing to do with modals, it also throws out this error. I have spent a whole day trying out different solutions on the Internet and nothing worked for me, so I’m hoping someone could provide some insights on how to properly solve this issue.

On a side note, if I serve or build the project with --aot parameter, upon launching it throws an error complaining about not being able to find ‘@angular/core’ module and it halts on a blank page forever. Not sure how helpful this info is but figure I should mention it in case it helps.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>