$ node -v //v0.10.29 $ npm -v //1.4.9
$ sudo npm install -g grunt $ sudo npm install -g bower $ sudo npm install -g yo $ sudo npm install -g generator-angular
You might have noticed the -g (or –global). This is because we want to install these node modules globally and not only for this project.Again you can check if everything is installed correctly with the -v (–version) option.
$ grunt -v // 0.4 $ bower -v //1.3.7 $ yo -v //1.2.0
sudo npm install -g cordova
$ cordova -v // 3.5.0-0.2.6
TL;DR: You can install all these in one command npm install -g cordova yo generator-angular bower grunt
cordova create . "com.example.app" "demo"doesn’t want to sit in a non-empty folder. (F.Y.I. I had the same problem with the Phonegap variant).
$ mkdir ionic-demo $ cd ionic-demo
$ cordova create . "com.example.app" "ionic-demo"
$ yo angular
- Add the DisallowOverscroll preference to prevent the application from overscrolling
<preference name="DisallowOverscroll" value="true"/>
- Add the UIWebViewBounce preference to prevent the bouncing animation in your application
<preference name="UIWebViewBounce" value="false" />
<script>tag for our Cordova script, which is needed by our application to include and use the Cordova magic.
/app/index.htmlWe could also remove the conditional tags for older browsers because this isn’t need for mobile applications (unless you’ll find a IE6 phone or something like that) Shims And browserhappy
echo 'www/' >> .gitignore (Add directory www to .gitignore) echo 'npm-debug.log' >> .gitignore (Add file npm-debug.log to .gitignore) echo '.*' >> .gitignore (Add hidden files to .gitignore but you should force add bower and co configuration files to git) echo 'platforms/' >> .gitignore (Add directory platformsto .gitignore) echo 'plugins/' >> .gitignore (Add directory plugins to.gitignore)
"ionic":"latest"but this keeps installing the 0.9 version, and to be honest the 1.0 beta version works a bit better.
/bower.jsonAfter we’ve added above lines to our bower.json file, we’ll need to run the following command to actually add these dependencies to our application.
$ bower install $ grunt wiredep
/test/karma.conf.jse.g. To make sure everything is OK, I would advise to run
grunt testuntil it gives no significant errors anymore.
$ grunt Test
npm install grunt-cordovacli —-save-dev
grunt.initConfig(). Cordovacli.options.path is set to ‘/’ because we use the rootfolder as base for our Cordova application. Cordovacli.add_platforms can be used to add platforms to our project (in this case iOS & Android) Cordovacli.add_plugins can be used to add additional plugings to our project. Cordovacli.build_xxx is the task that actually builds the application for iOS or Android. Cordovacli.run_xxx is the task that can be run to emulate the application in an emulator or on a device. We can now use these tasks by running
grunt buildyour latest changes sometimes aren’t included. So to be sure this doesn’t happen, we’ll transform the
grunt buildcommand to a
grunt build:iosand a
grunt build:androidcommand, like shown below. Now, when we run
grunt buildstill only ‘www’ will be updated, but when we would run
grunt build:android‘www’ gets updated and Cordova will build a “native” iOS or “native” android app, from your latest changes. In addition to our
grunt servetask, we can register a
grunt run:androidtask to emulate what we’ve build on an iOS emulator or Android emulator or device.