How to create a mobile app with Phonegap, Angular, Yeoman and Ionic
It’s assumed to have already downloaded all the tools (Phonegap, Cordova, Yeoman, Ionic and the Angular generator ).
Create a new Phonegap project:
phonegap create —name MyApp —id com.yourcompany.myapp myapp && cd myapp
Open the file myapp/www/config.xml and add this line:
<preference name”phonegap-version” value=“3.4.0” />
This enable phonegap to use the last version of the library.
Run the angular generator:
yo angular [myapp]
Install a helpful task for grunt:
npm install grunt-angular-phonegap —save-dev
Now add all platforms on which we want our application to works with:
cordova platform add [platform]
replace [platform] width android, ios, wp7 o wp8.
Now it’s time for Ionic, install it through bower:
bower install ionic —save-dev
Add all the required plugin of Phonegap.
1. phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
2. phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
3. phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status.git
4. phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
5. phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration.git
6. phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git
Add the cordova reference:
<script src=“cordova.js”></script>
in the file index.html
If bower it’s unable add the Ionic references, be sure to add it
Another think to do is update the target of Android in AndroidManifest.
Another thing we can do it’s modify the target of Android application in AndroidMonifest.
First run the grunt server:
grunt serve
To build the app for a specific platform use the grunt task previously installed:
grunt phonegap:build:platform
meanwhile to run the emulator use ionic:
ionic emulate platform
The debug is possible for iOS, using Safari by opening the Developers tool. For the test in device look the references of the Ionic App here