Most Asked Ionic Interview Questions
- Q1.What is Ionic Framework?
- IONIC is an HTML5 mobile app development framework targeted at
building hybrid mobile apps. Hybrid apps are those apps that has been developed using web
technology langauges such as HTML, CSS and JavaScript. Also hybrid apps have access to native
perform layer. Since Ionic is an HTML5 framework, it needs a native wrapper like Cordova or
PhoneGap in order to run as a native app.
- Q2.Advantage and disadvantage of ionic framework
-
Advantage
1. It is completely free and is considered as one of the best open-source software for
developing hybrid mobile applications.
2. Most importantly, angular is being used which is by default embedded in the ionic
framework.
3. It is mainly developed in HTML, CSS, and JS. Almost all the developers are familiar with
these languages.
disdvantage
1. Ionic applications may not be as secure as the native applications.
2. There is a performance gap between the ionic and the native applications. Ionic apps are
not as fast as the native apps.
3. The ionic applications may lack in some native functions. In such case, plugins have to be
developed.
- Q3.Types of storage available in ionic
- 5-Types of storage available in ionic framework
1. HTML5 local storage
2. Cookie and session storage
3. PouchDB
4. WebSQL
5. indexedDB
6. Webservice/api storage
7. Cordova storage.
- Q4.How can we test or debug ionic app
-
1. Android Emulator/ IOS Simulator
2. Chrome DevTools are a very powerful set of tools for debugging your application.
3. Ionic DevApp is a free app that makes it easy to run your Ionic app directly on your iOS
or Android device.
4. Usb Debugger.
- Q5.What is web view and what is the use of web view
- WebView is a view that display web pages inside your application.
You can also specify HTML string and can show it inside your application using WebView.
WebView makes turns your application to a web application.
A “webview” is a browser bundled inside of a mobile application producing what is called a
hybrid app. Using a webview allows mobile apps to be built using Web technologies (HTML,
JavaScript, CSS, etc.) but still package it as a native app and put it in the app store.
- Q6.Is ng-repeat or *ngFor useful to render 10000 records without
affecting scroll performance in ionic app
- No.We can’t render 10000 records using ng-repeat or *ngFor in ionic
app.else it will cause scroll performance.
- Q7.How can we render 10000k records in ionic app without
affecting scroll performance
- Ionic 1 - use collection-repeat or infinite scroll
Ionic 2 and Above - use virtual scroll or infinite scroll.
- Q8.Ionic 1 vs Ionic 2
-
- In Ionic 1 you have controllers that hold your logic, and templates that define your views.
Ionic 2 is the same, except you have classes instead of controllers.
- Ionic 2 CLI you can automatically generate pages, providers, tabs, pipes, components and
directives using command
ionic g page MyPage
where in ionic 1 you have to create manually
- Ionic 2 have Native scrolling for Android, IOS and windows where in for ionic 1 it has for
only android.
- Ionic 1 is based on Angular 1.x, and Ionic 2 is based on Angular >= 2.x which is based on
TypeScript. This is a superset of JavaScript and is maintained by Microsoft.
- the performance of Angular >= 2.x is better than Angular 1.x.
- Ionic 2 is based on Angular >= 2.x, developers have access to the new Web Animations (W3C)
API via the Angular animation system.
- Smart routing rules of Angular JS2 make Ionic 2 about 5 times faster than the initial
version, while the use of components and directives instead of controllers enables a higher
performance of Ionic 2 overall.
- Q9.Ionic 2 vs Ionic 3
-
- Ionic 3 is faster and compact.
- Ionic 3 is Compatible with TypeScript 2.1 and TypeScript 2.2
- Ionic 3 comprises support for lazy loading.
- Q10.What is PhoneGap/Cordova
- - 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.
-
- Q11.is ionic uses phoneGap?
- - 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.
- Q12.What is service/provider in ionic
- - Services play an important role in Ionic framework as they
provide information to our application and perform various tasks for us. Connectivity
Monitor, Simple Alert, data, Google Maps, etc. are some of the services which are built in
ionic framework.
- There are few concepts which are to be kept in mind while creating a service. Importing a
service, adding a provider to it, and injecting it are the most important thing.
- The services should be imported in the classes where they are to be used. When it is
injected inside a constructor, a new member variable is created which can be accessed from
anywhere within the class.
- A provider can be added in a service by two ways. Either it can be added to an individual
component, or it can be added globally to the application when bootstrapping the root
component.
- Q13.What is the role of Observable in ionic framework
-
- Observable is a JavaScript implementation of the observer pattern.
- Angular uses observables extensively - you'll see them in the HTTP service and the event
system.Its not specific feature of angular
- Observables will help us to work with the asynchronous functionalities in JavaScript.
- Observables emits multiple value over a period of time.
- Observable are Lazy. it is not called until we subscribe to the observable.
- Q14.What is Promises in ionic
- - Both Promises and Observables will help us to work with the
asynchronous functionalities in JavaScript.
- promices are not lazy. It call the service with .then and .catch
- We use promises as a sort of 'callback handle' - do something asynchronous in a service,
return a promise, and when the asynchronous work is done, the promise's then function is
triggered
- Q15.observable vs promises
- - Observables emits multiple value over a period of time where
promise emits only single value at a time.
- Observable are Lazy. it is not called until we subscribe to the observable where promices
are not lazy. It call the service with .then and .catch
- Observable can be canceled using unsubscribe method() where promise will not cancelled.
- Q16.What is the use of RxJS
- Reactive Extensions for JavaScript (RxJS) is a reactive streams
library that allows you to work with asynchronous data streams. RxJS can be used both in the
browser or in the server-side using Node.js. In this post we are going to introduce RxJS
basic concepts and how we can use them with AngularJS.
- Q17.what is service workers in angular
- Adding a service worker to an Angular application is one of the
steps for turning an application into a Progressive Web App (also known as a PWA). At its
simplest, a service worker is a script that runs in the web browser and manages caching for
an application. Service workers function as a network proxy.
- Q18.what are Progressive Web Apps
- Progressive Web Apps are nothing but advance level of Responsive
web apps.Progressive web applications that load like regular web pages or websites but can
offer the user functionality such as working offline, push notifications, and device hardware
access traditionally available only to native mobile applications.
Ionic allows you to ship your app to not only the app store, but also deploy to the mobile
web as a PWA.
- Q19.What's the difference between ionic build and ionic prepare?
- -ionic prepare copies all files from the www folder into the target
platform's www folder
-ionic build also does this, but also builds the app's source code
so that it can be run on a simulator/emulator or a device.
- Q20.What is MVC, MVP and MVVM Design Patterns?
- -MVC stands for Model-View-Controller. It is a software design
pattern which was introduced in 1970s. Also, MVC pattern forces a separation of concerns, it
means domain model and controller logic are decoupled from user interface (view). As a result
maintenance and testing of the application become simpler and easier.
-MVP stands for Model-View-Presenter.This pattern is similar to MVC pattern in which
controller has been replaced by the presenter. This design pattern splits an application into
three main aspects: Model, View and Presenter.The Presenter is responsible for handling all
UI events on behalf of the view.
-MVVM stands for Model-View-View Model. This pattern supports two-way data binding between
view and View model. This enables automatic propagation of changes, within the state of view
model to the View. Typically, the view model uses the observer pattern to notify changes in
the view model to model.
- Q21.What are the Tips and Tricks to Improve Mobile App
Performance
- -Cache images
-Compress and resize images
-Re-use data templates
-Reduce HTTP Requests
-Use loading validations
-Load data as you need it
-Create an offline mode
-Use Lazy Loading
- Q22.What are the Ionic Lifecycle Events?
-
- ionViewDidLoad: Fired only when a view is stored in memory.
- ionViewWillEnter: It’s fired when entering a page, before it becomes the active one.
- ionViewDidEnter: Fired when entering a page, after it becomes the active page.
- ionViewWillLeave: Fired when you leave a page, before it stops being the active one.
- ionViewDidLeave: Fired when you leave a page, after it stops being the active one
- ionViewWillUnload: Fired when a view is going to be completely removed (after leaving a
non-cached view).
- Q23.what is PhoneGap Build
-
PhoneGap Build is a cloud service for compiling PhoneGap applications. Adobe PhoneGap
provides a way for users to create mobile applications using technologies such as HTML, CSS,
and Javascript. ... Each vendor provides a different toolchain, and each PhoneGap release is
compatible with a specific set of tools.
- Q24.what is npm
-
npm (short for Node.js package manager) is a package manager for the JavaScript programming
language. It is the default package manager for the JavaScript runtime environment Node.js.
It consists of a command line client, also called npm, and an online database of public and
paid-for private packages, called the npm registry. The registry is accessed via the client,
and the available packages can be browsed and searched via the npm website. The package
manager and the registry are managed by npm, Inc.
- Q25.what is Node.JS
-
Node.js is an open-source, cross-platform JavaScript run-time environment that executes
JavaScript code outside of a browser.