Ionic Testing in a Browser

Use ionic serve to start a local development server for app dev and testing. This is useful for both desktop browser testing, and to test within a device  browser which is connected to the same network. Additionally, this command  starts LiveReload which is used to monitor changes in the file system. As soon
as you save a file the browser is refreshed automatically. Take a look at the Sass docs if you would also like to have ionic serve watch the project’s Sass files.

$ ionic serve [options]

LiveReload

By default, LiveReload will watch for changes in your www/ directory, excluding www/lib/. To change this, you can specify a watchPatterns property in the ionic.project file located in your project root to watch  (or not watch) for specific changes.

{
  "name": "myApp",
  "app_id": "",
  "watchPatterns": [
    "www/js/*",
    "!www/css/**/*"
  ]
}

For a reference on glob pattern syntax, check out globbing patterns on the Grunt website.

Note:

$ ionic setup sass 

will add a watchPatterns propery with the default values to your ionic.project file that you can then edit, in addition to the gulpStartupTasks property as  described in the Sass documentation.

Ionic framework create first app

Create an Ionic project using one of our ready-made app templates, or a blank one to start fresh.

#ionic start myApp tabs

Screen Shot 2015-10-27 at 09.07.50

Run it

Use the Ionic tool to build, test, and run your apps (or use Cordova directly). Make sure to substitute ios with android to build for Android.

Then, try Ionic View to share your apps with testers and clients, or to easily test on new devices.

$ cd myApp
$ ionic platform add ios
$ ionic build ios
$ ionic emulate ios
 

Install Ionic framework and Cordova

Install Ionic

First, install Node.js. Then, install the latest Cordova and Ionic command-line tools. Follow the Android and iOS platform guides to install required platform dependencies.

Note: iOS development requires Mac OS X. iOS simulator through the Ionic CLI requires the ios-sim npm package, which can be installed with the command sudo npm -g install ios-sim.

$ npm install -g cordova ionic

Linux reboot system with cron

Edit crontab:

sudo crontab -e

The first time you might have to choose your preferred editor (like nano)

Insert a line like

0 4   *   *   *    /sbin/shutdown -r +5

at the bottom. Explanation:

m      h    dom        mon   dow       command
minute hour dayOfMonth Month dayOfWeek commandToRun

so the line

  0 4   *   *   *    /sbin/shutdown -r +5

would reboot your system every day at 4:05am. (4:00am + 5 minutes)

Ctrl+X, Y, Enter should get you out of crontab (if using nano)

Note: you might have to run crontab -e as root, because shutdown needs root.