Lazy load pages random error:ERROR Error: Uncaught (in promise): invalid link:

后端 未结 12 1727
情书的邮戳
情书的邮戳 2021-01-01 14:35

I run into the following error every now and then.

ERROR Error: Uncaught (in promise): invalid link:MenuPage
    at d (polyfills.js:3)
    at l (polyfills.j         


        
12条回答
  •  忘掉有多难
    2021-01-01 14:58

    If you want lazy loading of components :

    Just add @IonicPage() decorator above the @Component decorator imported from 'ionic-angular' and restart your server after saving your work

    Example:

    ....
    import { IonicPage, NavController, NavParams, AlertController } from 'ionic-angular';
    ....
    
    @IonicPage()
    @Component({
    templateUrl : '',
    })
    export class XYZ{
       ........
    }
    

    Make sure you do not added the same page in app.module.ts file neither in declarations array nor in imports array.

提交回复
热议问题