- Set output Page pattern in
angular.json
, same with assets
field
"pages": [
{
"glob": "**/*.entry.ts",
"input": "./src/pages",
"output": "pages"
}
]
- This config is, in
src/pages
dir match *.entry.ts
file, and output in[outputDir]/pages
Dir
- Create code with the following structure
├── page1.component.html
├── page1.component.scss
├── page1.component.ts
├── page1.entry.json
├── page1.entry.ts
└── page1.module.ts
- Create a
page1.entry.ts
file, add code as follow
import { pageStartup } from 'angular-miniprogram';
import { Page1Component } from './page1.component';
import { Page1Module } from './page1.module';
pageStartup(Page1Module, Page1Component);
- Set output Component pattern in
angular.json
, same with assets
field
"components":[
{
"glob": "**/*.entry.ts",
"input": "./src/components",
"output": "components"
}
]
- Create code with the following structure
├── component1.component.html
├── component1.component.scss
├── component1.component.ts
├── component1.entry.json
├── component1.entry.ts
└── component1.module.ts
- Create a
component1.entry.ts
file, add code as follow
import { componentRegistry } from 'angular-miniprogram';
import { Component1Component } from './component1.component';
componentRegistry(Component1Component);
- This code is registry Component as a miniprogram Component
- because of auto init, so use
Registry