Pedro Henrique
Pedro Henrique

Reputation: 23

CLI generate page doesn't create the module file

When I use the ionic g page Example command, it only creates 3 files.

--example.html
--example.scss
--example.ts

don't create the file example.module.ts, I think I need it to create a modal because I'm getting Uncaught (in promise) error: invalid link: ItemPage. sorry for my english.

Upvotes: 2

Views: 1447

Answers (1)

Steve Kennedy
Steve Kennedy

Reputation: 5402

Future readers need to understand that these statements are time bombed. So while it's true now, it may not be true forever. It's just true right now.

You don't need module.ts files unless you are lazy loading your pages. Your promise error is probably not related. Delete any nested pages/.module.ts or components/.module.ts. Import the types directly into your app.module.ts. Make sure none of your pages have @IonicPage() on them.

As of today, Ionic chose to back-out of generating the module.ts file for every page/component, until lazy loading has been fully implemented. At one point, Ionic was generating this file, in preparation for lazy loading pages and components. But Ionic has since reverted to NOT using module file. They plan to implement lazy loading in a future release.

Read

https://forum.ionicframework.com/t/ionic-lazy-loading/98092

and

https://forum.ionicframework.com/t/how-to-make-the-non-lazy-loaded-generated-pages-lazy-loaded-again-ionic-angular-3-5-2-app-scripts-2-0-2/98102

Upvotes: 4

Related Questions