For instance, to update the @ionic/angular
package to the release tagged latest
, run:
It is recommended that packages get updated through the CLI since npm will now read package versions from the package-lock.json
first.
Editors
There are a lots of editors to choose from. Here are some of our favorites:
Using a Debugger
The debugger
keyword can be used to debug an app. When most browsers encounters a statement, running of JavaScript is stopped, and the browser will load its debugger. This can be used to set "breakpoints" in the app. For example, if a function that is not returning the correct value, the debugger can be used to step through the code and inspect variables.
When an app runs, it will pause at this function. From there, the developer tools can be used to run pieces of JavaScript, line by line, and inspect where exactly the function breaks.
Selecting devices from the device dropdown will change the user-agent, as well as the dimensions of the viewport.
Using the iOS Simulator
The iOS simulator enables testing and debugging of an app before it reaches an actual device. Before it can be used, , Apple's IDE, must be installed. The
Passing in the -lc
flag will enable livereload and log console output to an terminal.
Using the Genymotion Android Emulator
While the Android SDK comes with a stock emulator, it can be slow and unresponsive at times. Genymotion is an alternate emulator that is faster, and still allows accesses to native functionality like GPS and camera.
Safari can be used to debug an Ionic app on a connected iOS device.First, Web Inspector needs to be enabled on the connected device.Web Inspector can be found under Settings > Safari > Advanced
.Next, head over to the Safari on an Mac and enable Show Develop menu in menu bar under Safari > Preferences > Advanced
.The connected device should now appear in the Develop menu.From there, Safari's developer tools can be used to inspect and debug the app.
Remote Debugging - Android and Chrome
Chrome DevTools can be used to debug an app when it is running in the browser through ionic serve
, or deployed to an emulator or physical device.To inspect a emulator or physical device, go to chrome://inspect
in Chrome and select the target the has the running app.
Note: Physical Devices might need to have developer mode enabled in order to debug from Chrome.
Remote Debugging - VS Code Plugin
VSCode has a dedicated plugin for debugging apps built with Cordova. creates a bridge between the device and the VSCode Devtools and allow debugging to be done right in the editor.