Installation (安裝)
$ npm install -g ionic@latest
用 ionic --version
指令可以核對安裝成功.
Getting Started (開設一個新的project)
$ ionic start myNewProject
運行指令開啟Web View simulator
$ cd ./myNewProject
$ ionic serve
安裝 cordova 來建立 Android/iOS simulator
$ npm install -g cordova
Build Android :
$ ionic cordova build android --debug <--release>
Build iOS :
$ ionic cordova build iOS --debug <--release>
Add Pages:
$ ionic cordova build iOS --debug <--release>
開新的 pipes, components, pages, directives, providers && tabs (ionic-angular >= 3.0.0)
$ ionic generate [<type>] [<name>]
$ ionic generate
$ ionic generate component
$ ionic generate directive
$ ionic generate page
$ ionic generate pipe
$ ionic generate provider
$ ionic generate tabs
$ ionic generate component foo
$ ionic generate page Login
$ ionic generate page Detail --no-module
$ ionic generate page About --constants
$ ionic generate pipe MyFilterPipe
** Remarks: [Solution] ionic-build-prod-error-type-in-is-part-of-the-declarations-of-2-modules
Generate Pages 會自動生成 module.ts , 如果是IONIC 3, 或根本不需要, 就DELETE 它吧.
infolder ChatItem
1.delete chatitem.module.ts
2.in 25 chatitem.ts delete import{ Ionicpage } from ‘ionic-angular’;
3.in 2 chatitem.ts delete @Ionicpage()
4.in 5 terminal >ionic cordova build android --prod OR ionic cordova build ios --prod
其他一般CLI :
Command | Description |
---|---|
build | Build web assets and prepare your app for any platform targets |
docs | Open the Ionic documentation website |
generate | Generate pipes, components, pages, directives, providers, and tabs (ionic-angular >= 3.0.0) |
info | Print system/environment info |
link | Connect your local app to Ionic |
login | Login with your Ionic ID |
serve | Start a local dev server for app dev/testing |
signup | Create an Ionic account |
start | Create a new project |
telemetry | (deprecated) Opt in and out of telemetry |
upload | (deprecated) Upload a new snapshot of your app |
config get | Print config values |
config set | Set config values |
cordova build | Build (prepare + compile) an Ionic project for a given platform |
cordova compile | Compile native platform code |
cordova emulate | Emulate an Ionic project on a simulator or emulator |
cordova platform | Manage Cordova platform targets |
cordova plugin | Manage Cordova plugins |
cordova prepare | Copies assets to Cordova platforms, preparing them for native builds |
cordova requirements | Checks and print out all the requirements for platforms |
cordova resources | Automatically create icon and splash screen resources |
cordova run | Run an Ionic project on a connected device |
doctor check | Check the health of your Ionic project |
doctor ignore | Ignore a particular issue |
doctor list | List all issue identifiers |
git remote | Adds/updates the Ionic git remote to your local Ionic app repository |
integrations disable | Disable an integration |
integrations enable | Add various integrations to your app |
monitoring syncmaps | Sync Source Maps to Ionic Pro Error Monitoring service |
package build | (deprecated) Start a package build |
package download | (deprecated) Download your packaged app |
package info | (deprecated) Get info about a build |
package list | (deprecated) List your cloud builds |
ssh add | Add an SSH public key to Ionic |
ssh delete | Delete an SSH public key from Ionic |
ssh generate | Generates a private and public SSH key pair |
ssh list | List your SSH public keys on Ionic |
ssh setup | Setup your Ionic SSH keys automatically |
ssh use | Set your active Ionic SSH key |
留言列表