Mypage.module.ts vs mypage.ts


#1

Hi,
generating a new page in this way:
ionic generate page mypage

The CLI adds these two files: mypage.module.ts and mypage.ts.
Which is the difference between these two files?
What is the correct use of each file?

cld


#2

The *.module.ts file is used for lazy loading the component (aka page).

The *.ts is where bulk of your code will live.

These files are standard Angular files, and not Ionic-specific. Take a look at the Angular docs to learn more about them.


#3

Note that lazy loading is optional. You can remove the @IonicPage decorator from the component and nuke the .module.ts file if you wish.