12 Essential Ionic Interview Questions *
Toptal sourced essential questions that the best Ionic developers and engineers can answer. Driven from our community, we encourage experts to submit questions and offer feedback.
Hire a Top Ionic Developer NowInterview Questions
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:
- 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.
- Development cost is less compared to native iOS and Android applications.
- Ionic framework is excellent for quick application ideas prototyping.
Some of the disadvantages are:
- It is not suited for high-end graphics dependent applications or games.
- Performances are not as good as native applications, namely animations, scrolling, and network operations.
- 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
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.
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.
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.
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.
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);
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.
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.
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.
Why Toptal
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.
Looking for Ionic Developers?
Looking for Ionic Developers? Check out Toptal’s Ionic developers.
Hong Zheng
Hong is a full-stack developer and architect with 15+ years of experience, specializing in Angular, Ionic, Java, Spring Boot, and AWS. His freelance enterprise engagements include IEEE, Morgan Stanley, Barclay's Capital, BNP Paribas, Goldman Sachs, and Bank of America. Hong has also led the development of apps and systems for small and mid-sized companies. He is adept at interacting with business and tech professionals and has a master's and bachelor's degree in computer science.
Show MoreIvan Karačić
Ivan is a senior .NET developer with years of experience building enterprise applications. He is a skilled cross-platform mobile app developer using Ionic and React Native as his main tools. Ivan is just as comfortable starting a new project as diving into an existing one and getting up to speed in a short timeframe.
Show MoreFrancisco Clariá
Francisco is a full-stack engineer currently focused on hybrid apps (Ionic/Cordova) who has extensive experience in innovative solutions, Arduino, API/REST back-ends, distributed data manipulation systems, web applications, and UI/UX. He maintains a strong focus on sustainability and performance in his work and in the products he develops.
Show MoreToptal Connects the Top 3% of Freelance Talent All Over The World.
Join the Toptal community.