12 Essential Ionic Interview Questions *

Looking for Freelance Ionic Developer jobs? Design your lifestyle as a Ionic developer with Toptal.

Submit an Interview Question

What’s the difference between “ionic build” and “ionic prepare”?

ionic prepare <platform> copies all files from the www folder into the target platform’s www folder.

ionic build <platform> also does this, but also builds the app’s source code so that it can be run on a simulator/emulator or a device.

Performance of Ionic application is bad on older Android devices. Why is this, and what can be done to improve it?

Ionic framework uses the default web browser available for the device to run its hybrid application. Older versions of Android devices (4.0-4.3) use Android’s default browser, which has significantly less performance and standards compliance than the modern Chrome browser.

One way to resolve this issue is to use crosswalk along with Ionic framework. Crosswalk allows you to package a modern Chrome webview along with Ionic application, so an application does not have to rely on native Android browser. The end results are much better performances and modern web API across all Android versions.

What are the most prominent advantages and disadvantages of building applications using the Ionic framework?

The most obvious advantages are:

  1. Ionic framework builds hybrid applications using web technologies. It means web developers can easily build mobile applications too. Also, because it uses JavaScript, almost the same codebase can be used to build both iOS and Android applications.
  2. Development cost is less compared to native iOS and Android applications.
  3. Ionic framework is excellent for quick application ideas prototyping.

Some of the disadvantages are:

  1. It is not suited for high-end graphics dependent applications or games.
  2. Performances are not as good as native applications, namely animations, scrolling, and network operations.
  3. As mentioned, JavaScript animations are not as performant as native animations. However, there are JavaScript libraries, like tweenMAX, which provide decent animation performance on the devices.

Apply to Join Toptal's Development Network

and enjoy reliable, steady, remote Freelance Ionic Developer Jobs.

Apply as a Freelancer

What is the difference between PhoneGap, Cordova, and Ionic?

PhoneGap is a library that exposes native mobile phone functionalities as JavaScript API. When Adobe purchased PhoneGap, its open source core was donated to the Apache Software Foundation under the name Cordova. In the beginning, there was almost no difference between Cordova and PhoneGap. Although, over the years of development, Adobe started adding a proprietary set of the services to PhoneGap. Today, it is safe to say PhoneGap is Cordova plus extra Adobe services.

Ionic uses Cordova, not PhoneGap for its core tools. Beside native mobile phone functionalities, Ionic gives structure and code scalability to JavaScript applications by using AngularJS. It also provides a set of Angular directives and components to speed up application development.

How do you persist data between application launches using Ionic framework?

As Ionic behind the scene builds HTML5 based applications, you can use localStorage and sessionStorage API to persist data on the mobile phone. However, since localStorage can only store strings, objects need to be stringified before saving. Also, it is important to mention localStorage has size limit around 5MB.

How do you pass data from one view to another in Ionic applications?

Ionic uses AngularJS and UI-router. It means you can use Angular services or UI-router’s state resolve to pass data from one view to another. Since Angular services are singletons, data stored in services can be accessed across other Angular controllers.

As mentioned, UI-router provides a resolve configuration. For example:

$stateProvider
  .state('todos', {
    url: '/todos',
    controller: 'TodosCtrl',
    templateUrl: 'todos.html',
    resolve: {
      todos: function(TodosService) {
        return TodosService.getTodos()
      }
    }
  })

One advantage of resolve over stateful services is better testing: as resolve injects dependencies in the controller, it is easy to test them.

How can you render a 5000 item list in Ionic, without affecting scroll performance?

Ionic provides a collection-repeat directive that renders only visible items in the DOM. So even if the list is huge, like 5000 in our example, only items visible in a viewport are rendered. Thus, scroll performance is not affected.

What is the advantage of caching the views in Ionic apps? Provide examples.

Ionic by default caches up to ten views, which improves performance and also maintains different states in the views at the same time. For example, the cache can maintain scroll position in the views or active state of buttons.

Caching can be disabled per view by using cache: false in UI-router’s state config, like in the following example:

$stateProvider.state('myState', {
   cache: false,
   url : '/myUrl',
   templateUrl : 'my-template.html'
})

Caching can be also disabled globally, by setting maxCache to 0:

$ionicConfigProvider.views.maxCache(0);

How can you detect a platform (Android or iOS) at runtime in Ionic application?

Ionic provides platform classes: when the application is loaded, Ionic adds CSS classes to the <body> tag. For example, on iOS devices, Ionic adds platform-ios class to <body> tag. Ionic also adds OS version classes such as platform-ios8 (for iOS 8) and platform-android4_4 (for Android 4.4).

How can you access mobile phone native functionality in Ionic applications, for example the camera?

Ionic does not provide a camera API out of the box. However, since Ionic uses plugins architecture, and because it is based on Cordova, we can use Cordova plugins in our application. Ionic team provides a set of Cordova extensions with Angular wrappers, and they can be found at ngCordova.

To use Cordova plugins, we need to install the plugin using Ionic command install <plugin name>. In some cases, we will additionally need to add the plugin’s Angular module to your Angular application too.

To use a mobile phone’s camera in the Ionic application, we can call the camera API by using cordova-plugin-camera that is hosted on GitHub. This plugin defines a global navigator.camera object, which provides an API for taking pictures and for choosing images from the system’s image library.

How can you test Ionic applications?

Ionic applications are built using AngularJS. Angular has a rich set of test libraries and frameworks such as Jasmine and Karma test runner. These frameworks can be used to write unit tests for Ionic applications. Also, ionic-CLI provides live reload feature so the application can be tested in the browser. For example, the ionic serve command can be used to load the application in any browser. Thus, we can use Chrome Developer Tools or Mozilla Firefox with Firebug to debug and inspect Ionic applications.

In broad terms, how do you deploy an Ionic project onto a device?

To run your app, all you have to do is enable USB Debugging and Developer Mode on your Android device, then run ionic cordova run android --device from the command line.

There is more to interviewing than tricky technical questions, so these are intended merely as a guide. Not every “A” candidate worth hiring will be able to answer them all, nor does answering them all guarantee an “A” candidate. At the end of the day, hiring remains an art, a science — and a lot of work.

Submit an interview question

Submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of Toptal, LLC.

* All fields are required

Rashid Wakileh

Freelance Ionic Developer

United StatesToptal Member Since November 17, 2014

Rashid is a passionate lead front-end engineer. He is an expert in test-driven development, and has extensive experience in leading teams to create software solutions. He enjoys using JavaScript frameworks and thoroughly testing all aspects of his code.

Show More

Michal Mikolajczyk

Freelance Ionic Developer

PolandToptal Member Since June 29, 2014

Michal is a senior software engineer and community leader for Toptal Warsaw. He communicates well and takes the initiative needed to help startups scale. Michal writes clean, functional code, automates infrastructure, and enjoys coordinating and scoping tasks. A former digital nomad, Michal speaks at conferences, and writes articles for the Toptal Blog. His professional interests include blockchains and artificial intelligence.

Show More

Ivan Turkovic

Freelance Ionic Developer

United KingdomToptal Member Since May 4, 2015

Ivan is a geek, visionary, startup enthusiast, occasional tech blogger, software developer, and entrepreneur based in London. He has no use for mediocrity and won't settle for average. He's been known to stay up all night thinking about how he can be truly exceptional at what he does. You might call this a positive trait or competitive spirit, but he calls it passion.

Show More

Looking for Ionic Developers?

Looking for Ionic Developers? Check out Toptal’s Ionic developers.

Toptal Connects the Top 3% of Freelance Talent All Over The World.

Join the Toptal community.

Learn more