11 Essential Ionic Interview Questions*

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.
Fields marked with an asterisk (*) are required
Comment submitted succesfully. Thank you.
We are going to review the comment and get back to you as soon as possible.

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.

Fields marked with an asterisk (*) are required
Comment submitted succesfully. Thank you.
We are going to review the comment and get back to you as soon as possible.

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.

Fields marked with an asterisk (*) are required
Comment submitted succesfully. Thank you.
We are going to review the comment and get back to you as soon as possible.

Find top Ionic talent today. Toptal can match you with the best developers to finish your project.

Hire Toptal’s Ionic Developers

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.

Fields marked with an asterisk (*) are required
Comment submitted succesfully. Thank you.
We are going to review the comment and get back to you as soon as possible.

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.

Fields marked with an asterisk (*) are required
Comment submitted succesfully. Thank you.
We are going to review the comment and get back to you as soon as possible.

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);
Fields marked with an asterisk (*) are required
Comment submitted succesfully. Thank you.
We are going to review the comment and get back to you as soon as possible.

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).

Fields marked with an asterisk (*) are required
Comment submitted succesfully. Thank you.
We are going to review the comment and get back to you as soon as possible.

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.

Fields marked with an asterisk (*) are required
Comment submitted succesfully. Thank you.
We are going to review the comment and get back to you as soon as possible.

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.

Fields marked with an asterisk (*) are required
Comment submitted succesfully. Thank you.
We are going to review the comment and get back to you as soon as possible.

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.

Fields marked with an asterisk (*) are required
Comment submitted succesfully. Thank you.
We are going to review the comment and get back to you as soon as possible.

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.

Fields marked with an asterisk (*) are required
Comment submitted succesfully. Thank you.
We are going to review the comment and get back to you as soon as possible.
* 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
Thanks for submitting your question.
Our editorial staff will review it shortly. Please note that 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.
John Ginsberg
United Kingdom
John is a developer and entrepreneur with 15+ years of hands-on coding experience. He has worked on a variety of projects, including developing large-scale websites, an email marketing platform delivering millions of emails per day, and social media integration with Facebook, Twitter, and LinkedIn.
Avinash Kaza
United States
Avinash is a senior developer with experience designing & developing data visualizations that answer difficult questions by using the latest tools like HTML5 Canvas. A seasoned product development expert who coaches teams on collaboration while figuring out the best solutions to difficult problems.
Nazar Ivanenko
Ukraine
Nazar has a very strong background in mathematics and significant experience working in a variety of business environments. Having worked with companies both large and small, he has the background to design simple solutions to complex problems. Highly motivated, he's eager to take on any challenge.