- Setting up important packages
- Setting up Node JS and NPM
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
- Setting up Bower
sudo apt-get update
sudo npm install bower -g
- Downloading and setting up the project
- Visit this link. You would get a file 'ionic.zip' downloaded.
- Extract it into a desired location. You would get a folder 'ionic' which contains 4 folders - 'angular-code', 'ionic-code', 'json-server' and 'presentation'.
- Navigate (cd) into each of the folders in each separate terminal windows.
- Setting up the JSON server
- In the terminal window with the json-server directory open, do the following:
Install the json-server package to run the server using:
sudo npm install json-server -g
Run the json-server using:
json-server --watch db.json
You will now have the json-server running at localhost:3000/.
Leave the process running in the terminal window. Press Ctrl-C to stop it any time.
- Setting up the angular project
- In the terminal window with the angular-code directory open, do the following:
- Setup a server for running the angular-code using:
python -m SimpleHTTPServer 8000
- You will now have the complete angular project running at localhost:8000/.
- Leave the process running in the terminal window. Press Ctrl-C to stop it any time.
- Setting up a server for viewing the presentation:
(The presentation needs to run on a server because there are ionic demos that require a server to run)
- In the terminal window with the presentation directory open, do the following:
- Installing packages required for running the presentation:
sudo npm install
- Setup a server for running the presentation using:
python -m SimpleHTTPServer 5555
- You will now have the complete angular project running at localhost:5555/.
- Leave the process running in the terminal window. Press Ctrl-C to stop it any time.
- Running the ionic project
- In the terminal window with the ionic-code directory open, do the following:
- Installing npm packages required for running the ionic project:
sudo npm install -g cordova
sudo npm install -g ionic
sudo npm install gulp-cli -g
sudo npm install
- Installing bower packages required for running the ionic project:
sudo bower install
- Run the ionic project as a website using: (Stop with Ctrl-C)
ionic serve
- Run the ionic project in the ionic lab using: (Stop with Ctrl-C)
ionic serve --lab
- To run and test your ionic project on an Android mobile device, you need to have the Android SDK and Java JDK setup. (If you have a working Android Studio setup, it is adequate). Then run the following commands:
ionic platform add android
ionic build android
ionic run android
- To run and test your ionic project on an Android mobile device using the ionic cloud,
Create an account in the ionic cloud here
Install the ionic view app by searching for 'ionic view' in Google Play Store. Here is the link to the app. Signin to the ionic cloud using the app.
Then upload the app to the ionic cloud using:
ionic upload
You will be asked to enter your credentials and then, the app will be uploaded to the ionic cloud.
You can now view the app in your ionic view app in the mobile phone.
- So we're done with the setup. I highly encourage you to tweak into and play with the code to understand how the code works and contact me for queries via the contact links in the presentation.
- Here is a list of tutorials that will help you learn and get-started about ionic.