Ionic Interview Questions and Answers

Find 100+ Ionic interview questions and answers to assess candidates’ skills in hybrid mobile app development, Angular integration, UI components, Cordova/Capacitor, and performance.
By
WeCP Team

As organizations build cross-platform mobile applications with faster development cycles, recruiters must identify Ionic professionals who can deliver high-quality apps using web technologies. Ionic enables developers to build iOS, Android, and web applications from a single codebase using HTML, CSS, JavaScript, and frameworks like Angular, React, or Vue.

This resource, "100+ Ionic Interview Questions and Answers," is tailored for recruiters to simplify the evaluation process. It covers a wide range of topics—from Ionic fundamentals to advanced mobile development concepts, including UI components, native integrations, and performance optimization.

Whether you're hiring Ionic Developers, Mobile App Developers, or Hybrid App Engineers, this guide enables you to assess a candidate’s:

  • Core Ionic Knowledge: Ionic framework architecture, components, theming, routing, and CLI usage.
  • Advanced Skills: Native device integrations using Capacitor/Cordova, performance optimization, offline storage, push notifications, and mobile UI/UX best practices.
  • Real-World Proficiency: Building cross-platform apps, integrating APIs, handling platform-specific behaviors, and publishing apps to the App Store and Play Store.

For a streamlined assessment process, consider platforms like WeCP, which allow you to:

  • Create customized Ionic assessments tailored to hybrid mobile and cross-platform development roles.
  • Include hands-on tasks such as building UI flows, integrating native plugins, or debugging mobile performance issues.
  • Proctor exams remotely while ensuring integrity.
  • Evaluate results with AI-driven analysis for faster, more accurate decision-making.

Save time, enhance your hiring process, and confidently hire Ionic developers who can build fast, scalable, and cross-platform mobile applications from day one.

Ionic Interview Questions

Ionic – Beginner (1–40)

  1. What is Ionic, and what problem does it solve?
  2. What is the difference between Ionic and Cordova?
  3. Explain the architecture of an Ionic application.
  4. What are Ionic components?
  5. How do you install the Ionic CLI?
  6. What is Capacitor in Ionic?
  7. How is Capacitor different from Cordova?
  8. What are Ionic pages and how are they generated?
  9. How does Ionic use Angular?
  10. Explain Ionic’s folder structure.
  11. What is ion-content?
  12. What is ion-grid?
  13. What is the purpose of ion-nav and ion-router?
  14. How do you navigate between pages in Ionic Angular?
  15. What is Ionic CLI used for?
  16. How do you create a new Ionic project?
  17. What is Live Reload in Ionic?
  18. What is Ionic Storage?
  19. How do you use Ionic forms?
  20. What are Ionic lifecycle events?
  21. What is ion-modal?
  22. How do you create a modal in Ionic?
  23. What is ion-alert?
  24. What is the difference between ion-list and ion-item?
  25. Explain how to use ion-tabs.
  26. What is theming in Ionic?
  27. What is ion-refresher and when is it used?
  28. What is ion-infinite-scroll?
  29. How do you apply global styles in Ionic?
  30. What is ion-loading?
  31. How do you deploy an Ionic app to a device?
  32. How do you test an Ionic app in the browser?
  33. What is ionic serve?
  34. What is the purpose of config.xml in Cordova projects?
  35. What is the difference between hybrid and native apps?
  36. How does Ionic integrate with native device features?
  37. What are plugins in Ionic?
  38. What is a web view?
  39. How do you debug an Ionic app on Android/iOS?
  40. How do you build APK/IPA using Ionic?

Ionic – Intermediate (1–40)

  1. Explain the Ionic and Angular integration architecture.
  2. How does Capacitor manage native platforms?
  3. Explain Capacitor plugin architecture.
  4. How do you handle authentication in Ionic apps?
  5. What is routing in Ionic Angular and how does it differ from navigation in Ionic v3?
  6. How do you implement lazy loading in Ionic Angular?
  7. Explain the working of IonSlides.
  8. How do you optimize an Ionic app for performance?
  9. What are custom Ionic themes?
  10. How does Ionic handle responsive UI?
  11. Explain media queries vs Ionic utilities.
  12. What is a service in Angular and how is it used in Ionic?
  13. How do you use HttpClient inside Ionic for API calls?
  14. What are interceptors and how are they used in Ionic?
  15. How do you persist data in Ionic using Storage or Preferences?
  16. How do you use Capacitor Camera API?
  17. What is the purpose of WebView in Ionic?
  18. What is ion-virtual-scroll?
  19. How do you implement push notifications in Ionic?
  20. What are gestures in Ionic?
  21. Explain difference between IonNav and Angular Router.
  22. How do you handle app state management in Ionic?
  23. What is NgZone and why is it important in hybrid apps?
  24. Explain the Ionic build process.
  25. How do you integrate Firebase with Ionic?
  26. What is deep linking in Ionic apps?
  27. What is PWAs support in Ionic?
  28. How do you enable offline mode in Ionic apps?
  29. How do you secure API keys in Ionic apps?
  30. What is the difference between ionic build, ionic serve, ionic capacitor run?
  31. How do you manage environment files in Ionic?
  32. How do you debug Capacitor plugins?
  33. What is ion-skeleton-text used for?
  34. What is the Angular change detection mechanism in Ionic?
  35. How do you create reusable components in Ionic?
  36. What is hybrid app performance bottleneck and how do you fix it?
  37. How do you configure splash screens and app icons?
  38. Explain the lifecycle differences: Angular vs Ionic vs Capacitor.
  39. What is the purpose of Capacitor bridge?
  40. How do you publish an Ionic PWA?

Ionic – Experienced (1–40)

  1. Explain the internal architecture of Capacitor Runtime.
  2. How does Ionic optimize rendering performance under the hood?
  3. Describe the internals of Ionic Web Components.
  4. What is Stencil.js and how does it relate to Ionic?
  5. Explain the shadow DOM usage inside Ionic components.
  6. Describe the internal working of Ionic change detection and event batching.
  7. How do you architect a large-scale enterprise Ionic app?
  8. What advanced caching strategies are recommended for Ionic apps?
  9. How do you handle performance limits of WebView in large apps?
  10. Compare performance between Ionic + Capacitor vs React Native vs Flutter.
  11. How do you implement advanced offline sync architecture?
  12. Discuss database options: SQLite vs IndexedDB vs Storage.
  13. Explain memory optimization techniques for hybrid apps.
  14. How does Ionic handle accessibility internally?
  15. What is the internal working of Capacitor’s JS-to-Native bridge?
  16. How do you build a custom Capacitor plugin with native iOS and Android code?
  17. Explain advanced security implementation in Ionic enterprise apps.
  18. How do you handle certificate pinning in Ionic?
  19. How do you integrate Ionic with micro frontends?
  20. How do you containerize Ionic apps for CI/CD pipelines?
  21. What is the internal working of Web Animations API used by Ionic?
  22. How do you implement multi-tenant architecture in Ionic apps?
  23. How do you analyze performance traces of Ionic apps?
  24. How do you debug memory leaks in an Ionic hybrid app?
  25. Explain rendering pipeline of Ionic with Capacitor WebView.
  26. Discuss strategies for handling huge lists beyond virtual scroll.
  27. What are the challenges of accessing advanced native APIs with Capacitor?
  28. How do you scale Ionic apps with modular monorepo architecture?
  29. Explain enterprise-grade crash logging integration (Sentry/Crashlytics).
  30. How do you handle biometric authentication with security best practices?
  31. Discuss building an offline-first encrypted data layer.
  32. How do you implement advanced state management (NgRx, Zustand, MobX) in Ionic?
  33. Explain multi-platform UI consistency strategy.
  34. Discuss advanced deployment pipelines for Android, iOS, and Web.
  35. Explain native performance tuning for plugins that require heavy computation.
  36. What are the limitations of hybrid apps and how do you mitigate them?
  37. How do you test Ionic apps using Jest, Cypress, or Playwright?
  38. Explain the PWA service worker internals generated by Ionic.
  39. How do you secure WebView from injection attacks?
  40. What are the best practices for maintaining a large Ionic codebase over years?

Ionic Interview Questions and Answers

Beginner (Q&A)

1. What is Ionic, and what problem does it solve?

Ionic is an open-source UI framework designed for building cross-platform mobile, web, and desktop applications using standard web technologies—HTML, CSS, and JavaScript—along with frameworks like Angular, React, or Vue.

The core problem Ionic solves is:

  • Developers traditionally had to write separate codebases for Android, iOS, and Web.
  • This caused duplication, extra cost, inconsistent UI, and difficult maintenance.

Ionic solves this by allowing developers to write a single codebase that runs across:

  • Android (through Capacitor/Cordova)
  • iOS (through Capacitor/Cordova)
  • Web browsers (as a PWA)

Ionic provides:

  • A rich set of pre-built UI components that look and feel native (buttons, menus, tabs, lists).
  • A unified development experience.
  • Ability to access native device features via Capacitor plugins.

Thus, Ionic dramatically reduces development effort, improves maintainability, and speeds up deployment across platforms.

2. What is the difference between Ionic and Cordova?

Ionic and Cordova are related but serve different purposes.

Ionic

  • A front-end UI framework.
  • Provides components, styling, navigation, animations, layout utilities.
  • Focuses on the look and feel of the application.
  • Framework-agnostic: supports Angular, React, Vue, or Vanilla JS.
  • Uses Stencil to generate web components for native-like UI.

Cordova

  • A native bridge platform.
  • Allows JavaScript to communicate with native device functions like:
    • Camera
    • Geolocation
    • File System

Key Differences

FeatureIonicCordovaPurposeUI frameworkNative runtime bridgeProvidesComponents, layouts, UXNative plugins, app packagingRuns where?Browser + mobileMobile onlyReplacementNoneBeing replaced by Capacitor

Cordova is not required for Ionic anymore because Capacitor is now the official native runtime.

3. Explain the architecture of an Ionic application.

An Ionic application follows a three-layer architecture:

1. Presentation Layer (UI Layer)

This layer is built using HTML, CSS, JavaScript, and Ionic Web Components.

Includes:

  • ion-header
  • ion-toolbar
  • ion-content
  • ion-buttons
  • ion-lists

These components render with platform-specific styling (iOS, Android).

2. Application Layer (Framework Layer)

This is powered by Angular/React/Vue.

Includes:

  • Routing
  • State management
  • Business logic
  • Services
  • API integrations

Angular (most common) contributes:

  • Dependency injection
  • Observables
  • Components
  • Modules

3. Native Bridge Layer (Capacitor Runtime)

This uses Capacitor plugins to access native features:

  • Camera
  • Push notifications
  • GPS
  • File system
  • Storage

This layer contains:

  • WebView
  • Native Android/iOS wrappers
  • Capacitor JS bridge

When packaged for Android/iOS, the app runs inside a native WebView container but still behaves like a real native app.

4. What are Ionic components?

Ionic components are pre-built UI elements created using Web Components and SVG/CSS-based UI patterns. They are reusable building blocks for creating mobile-friendly user interfaces.

Examples:

  • ion-header, ion-toolbar, ion-title
  • ion-button, ion-icon
  • ion-list, ion-item, ion-avatar
  • ion-tabs, ion-side-menu
  • ion-grid for responsive layouts

Key Features:

  • Auto-adapt to platforms (iOS = translucent headers, Android = Material Design ripple).
  • Accessible by default (ARIA attributes).
  • Built using Stencil.js, making them fast and lightweight.
  • Support gestures, animations, touch events, and virtual scrolling.

These components allow developers to create polished applications without manually coding complex UI from scratch.

5. How do you install the Ionic CLI?

The Ionic CLI (Command Line Interface) is installed globally using npm.

Installation Command:

npm install -g @ionic/cli

What the CLI provides:

  • Creating new projects
  • Generating pages, components, and services
  • Running the app on browser or device
  • Building production bundles
  • Adding Android/iOS platforms via Capacitor
  • Deploying PWAs

Requirements before installing:

  • Node.js (latest LTS version recommended)
  • npm package manager
  • Git for project versioning

After installation, verify using:

ionic -v

This confirms that Ionic CLI is correctly installed and ready to use.

6. What is Capacitor in Ionic?

Capacitor is the official native runtime for Ionic applications. It provides a modern WebView wrapper and a JavaScript bridge to access native device features.

Key Features of Capacitor:

  • Allows apps to run on:
    • iOS
    • Android
    • Web (PWA)
  • Simple APIs for native features:
    • Camera
    • Filesystem
    • Geolocation
    • Toasts
  • Supports custom native plugin development.
  • Automatically keeps web and native projects in sync.

Capacitor solves major limitations of Cordova by introducing:

  • Better debugging
  • Live reload on devices
  • Stronger iOS/Android integration
  • Native ES modules

Capacitor is now the primary native tool recommended by Ionic.

7. How is Capacitor different from Cordova?

Capacitor is a modern replacement for Cordova.

Main Differences

FeatureCapacitorCordovaPhilosophyWeb-firstNative-firstPlugin systemModern, consistent, easierLegacy, inconsistentProject structureSyncs with a real Xcode/Android Studio projectCordova controls native projectsWeb supportFull PWA supportNo web supportLive reloadBuilt-inHard to configureNative codeDirect editing allowedChanges overwritten

Capacitor Advantages:

  • Faster runtime performance
  • TypeScript support
  • Better error handling
  • Official Ionic ecosystem integration

Cordova is still available but considered "legacy".

8. What are Ionic pages and how are they generated?

Pages in Ionic are view components that represent screens in the mobile app (Home, Login, Profile, etc.).

A typical Ionic page contains:

  • HTML template (.html)
  • TypeScript logic (.ts)
  • Styling (.scss)

Generating a Page:

Using Ionic CLI:

ionic generate page home

This creates a folder:

home/
  home.page.html
  home.page.ts
  home.page.scss
  home.page.spec.ts

Pages are integrated into the app through Angular routing:

{ path: 'home', component: HomePage }

Pages help structure the app into modular, navigable UI screens.

9. How does Ionic use Angular?

Ionic uses Angular as the application framework that handles:

  • Routing/navigation
  • Dependency injection
  • Component architecture
  • Reactive forms
  • HTTP APIs
  • Change detection
  • Services and Observables

Ionic provides UI components, but Angular provides the application logic scaffolding.

Ionic + Angular benefits:

  • Clear MVC-like structure
  • Strong tooling (Angular CLI)
  • Mature ecosystem
  • Excellent type safety through TypeScript

Thus, Angular is the backbone that powers app logic, while Ionic handles UI.

10. Explain Ionic’s folder structure.

A typical Ionic Angular app has this folder structure:

project/
├── src/
│   ├── app/
│   │   ├── app-routing.module.ts
│   │   ├── app.module.ts
│   │   └── pages/modules/services
│   ├── assets/
│   ├── environments/
│   ├── global.scss
│   ├── index.html
│   └── theme/
├── capacitor.config.ts
├── package.json
└── angular.json

Key Folders:

1. /src/app/

  • Contains all modules, pages, components, and services.
  • app.module.ts bootstraps the Ionic app.
  • app-routing.module.ts defines navigation routes.

2. /src/assets/

  • Static assets: images, fonts, icons.

3. /src/theme/

  • Application-wide theming variables.

4. /src/environments/

  • Environment configuration (dev/prod).

5. /src/global.scss

  • Global CSS utility classes.

6. /android and /ios

  • Native Capacitor projects created via npx cap add android.

This structure ensures maintainability, scalability, and modular development.

11. What is ion-content?

ion-content is one of the most essential Ionic components. It acts as the main scrollable container for the body of a page. Everything displayed inside the page (text, lists, forms, buttons, cards) is usually placed inside ion-content.

It provides:

1. Automatic Layout + Scroll Handling

  • Manages touch-based scrolling for mobile platforms.
  • Implements smooth inertial scrolling.
  • Supports pull-to-refresh (ion-refresher) and infinite scroll (ion-infinite-scroll).

2. Safe Area Support

It automatically adjusts the content to fit within iOS safe areas such as:

  • Notch
  • Status bar
  • Home gesture bar

3. Built-in Color & Background Styling

ion-content supports backgrounds:

  • Images
  • Gradients
  • Custom themes

4. Virtual Scroll / Large Data Optimization

When used with lists, ion-content helps ensure efficient rendering on mobile devices through virtual scrolling.

Example:

<ion-content>
  <h1>Welcome</h1>
  <p>This is scrollable content.</p>
</ion-content>

Overall, ion-content is the core visual container for screen-level UI in Ionic apps.

12. What is ion-grid?

ion-grid is Ionic’s responsive layout system based on a 12-column grid, similar to Bootstrap but optimized for mobile.

It allows developers to create flexible, responsive UI layouts that automatically adjust for:

  • Mobile phones
  • Tablets
  • Desktops (when building PWAs)

Key Features:

  1. 12-column structure
    Layout is built using rows and columns.
  2. Breakpoint system
    Columns can change size depending on screen width (xs, sm, md, lg, xl).
  3. Automatic spacing & alignment
    Provides gutter spacing and alignment classes.
  4. Mobile-first optimization
    Built to make mobile screens look visually balanced and readable.

Example:

<ion-grid>
  <ion-row>
    <ion-col size="6">Left</ion-col>
    <ion-col size="6">Right</ion-col>
  </ion-row>
</ion-grid>

ion-grid is used for structuring complex UIs, aligning components, and building adaptive layouts.

13. What is the purpose of ion-nav and ion-router?

Ionic apps historically used ion-nav, but now Ionic Angular primarily uses Angular Router wrapped by ion-router.

ion-nav

  • Used in older Ionic versions (v3) for stack-based navigation.
  • Allows pushing and popping pages like a native navigation controller.
  • Not recommended for Ionic Angular apps unless building custom navigation flows.

ion-router

  • Built on top of Angular Router.
  • Handles modern navigation in Ionic Angular apps using URLs.
  • Allows:
    • Lazy loading
    • Tab navigation
    • Nested routing
    • Deep linking

Why ion-router is preferred today:

  • More predictable navigation
  • URL-based system (better SEO for PWAs)
  • Works seamlessly with Angular features

In summary:

  • ion-nav = old stack-based, pushed pages manually
  • ion-router = new Angular-friendly, URL-driven navigation system

14. How do you navigate between pages in Ionic Angular?

Navigation in Ionic Angular uses Angular Router, not ion-nav.

1. Declare routes in app-routing.module.ts

const routes: Routes = [
  { path: 'home', component: HomePage },
  { path: 'about', component: AboutPage }
];

2. Navigate programmatically

Using Angular’s Router service:

this.router.navigate(['/about']);

3. Navigate using template links

<ion-button routerLink="/about">Go to About</ion-button>

4. Back navigation

this.navController.back();

5. Passing data

this.router.navigate(['/details', itemId]);

Or via navigation extras:

this.router.navigate(['details'], {
  queryParams: { id: 5 }
});

Modern Ionic apps rely on Angular Router for predictable, scalable navigation patterns.

15. What is Ionic CLI used for?

The Ionic CLI (Command Line Interface) is a powerful development tool used to:

1. Create new apps

ionic start myApp tabs

2. Run apps

ionic serve

Starts a dev server with live reload.

3. Generate components, pages, services

ionic generate page login
ionic generate service auth

4. Build production bundles

ionic build

5. Integrate Capacitor

ionic capacitor add android
ionic capacitor run ios

6. Deploy apps

Supports deploy to web, Android, or iOS.

7. Enable Live Reload on devices

CLI simplifies debugging on real hardware.

In short, Ionic CLI streamlines the entire development lifecycle.

16. How do you create a new Ionic project?

To create a new Ionic project, follow these steps:

1. Ensure Ionic CLI is installed

npm install -g @ionic/cli

2. Create the project

ionic start myApp tabs

You can choose templates:

  • blank
  • tabs
  • sidemenu
  • list
  • tutorial

3. Choose a framework

CLI will ask:

  • Angular
  • React
  • Vue

4. Navigate into the project

cd myApp

5. Run the application

ionic serve

This launches your app with hot reload.

Creating a new project through the CLI provides a fully scaffolded Ionic and Angular environment ready for development.

17. What is Live Reload in Ionic?

Live Reload is a feature that automatically refreshes the app whenever code changes are made.

How it works:

  • CLI watches files (.html, .ts, .scss).
  • When a change is detected:
    • It rebuilds the app.
    • It refreshes the browser or device WebView.

Run with Live Reload:

ionic serve

Live Reload on Android/iOS device:

ionic capacitor run android -l --external

Benefits:

  • Speeds up development.
  • No need to rebuild the app manually.
  • Helps debug UI quickly.
  • Shortens dev time significantly.

It is one of the most productive features in the Ionic ecosystem.

18. What is Ionic Storage?

Ionic Storage is a key–value data storage engine used to store persistent data in an Ionic application.

It supports multiple storage engines:

  • IndexedDB
  • SQLite (via Capacitor plugin)
  • LocalStorage

Why it's useful:

  • Works on both Web and Mobile.
  • Automatically picks the best available storage.
  • Transparent fallback system.

Example usage:

Import module:

imports: [
  IonicStorageModule.forRoot()
]

Usage in code:

await this.storage.set('token', 'abc123');
const token = await this.storage.get('token');

Use cases:

  • Saving login tokens
  • Storing user preferences
  • Caching API data
  • Offline storage

Ionic Storage is the recommended solution for small-to-medium persistent data needs.

19. How do you use Ionic forms?

Ionic forms are built on top of Angular Forms Module, offering both:

  • Template-driven forms
  • Reactive forms (recommended for complex forms)

1. Template-driven form example

<form #f="ngForm">
  <ion-input name="email" ngModel></ion-input>
</form>

2. Reactive form example

In TypeScript:

form = this.fb.group({
  email: ['', [Validators.required, Validators.email]],
  password: ['', Validators.required]
});

In HTML:

<form [formGroup]="form">
  <ion-input formControlName="email"></ion-input>
  <ion-input formControlName="password"></ion-input>
</form>

Ionic-specific features:

  • ion-input, ion-select, ion-checkbox, ion-datetime
  • Built-in validation messages
  • Error highlighting
  • Mobile-friendly touch UI

Ionic forms combine Angular’s powerful form engine with mobile-optimized components.

20. What are Ionic lifecycle events?

Ionic lifecycle events are hooks that allow you to run code at specific moments when a page becomes active or inactive.

These events are triggered by Ionic’s navigation system, not Angular’s component lifecycle.

Common Ionic lifecycle events:

EventDescriptionionViewWillEnterFired just before the page becomes active. Use to load data.ionViewDidEnterFired when page is fully visible. Good for starting animations.ionViewWillLeaveFired before navigating away. Use to pause listeners.ionViewDidLeaveFired after leaving page. Cleanup resources.

Example usage:

ionViewWillEnter() {
  console.log('Page is about to be shown');
}

ionViewDidEnter() {
  console.log('Page fully visible');
}

Why they are important:

  • Handle page-level logic
  • Improve performance
  • Fetch data on entry
  • Stop timers and listeners on exit

These events complement Angular’s lifecycle (ngOnInit, ngOnDestroy) for a more mobile-oriented behavior.

21. What is ion-modal?

ion-modal is a powerful Ionic component used to display content on top of the current page, similar to a popup or dialog. Modals are commonly used in mobile apps to present:

  • Login forms
  • Filters
  • Profile previews
  • Settings
  • Confirmation dialogs
  • Additional information without leaving the current page

Key Features:

  1. Displayed as an overlay—does not replace the current page.
  2. Supports custom components, meaning you can load a full page inside a modal.
  3. Automatically handles animations (iOS-style slide-up, Android-style fade).
  4. Can be dismissed by backdrop click (optional).
  5. Can pass data into the modal and receive data back.

Why modals are important:

  • Improve UX by keeping the user in context.
  • Provide lightweight navigation.
  • Allow interactive UI that does not require routing.

22. How do you create a modal in Ionic?

Creating a modal in Ionic Angular involves using the ModalController.

Step 1: Import ModalController

import { ModalController } from '@ionic/angular';

Step 2: Inject ModalController into constructor

constructor(private modalCtrl: ModalController) {}

Step 3: Create and present the modal

async openModal() {
  const modal = await this.modalCtrl.create({
    component: MyModalPage,     // Component to load inside modal
    componentProps: {
      userId: 10                // Pass data to modal
    }
  });

  await modal.present();
}

Step 4: Dismiss modal from inside

this.modalCtrl.dismiss({
  result: 'success'
});

Step 5: Get data back from modal

const { data } = await modal.onWillDismiss();
console.log(data);

Modals in Ionic are highly flexible and can load full-screen pages, custom UI layouts, or small dialog-style screens.

23. What is ion-alert?

ion-alert is a lightweight, pre-styled dialog component used to show:

  • Messages
  • Confirmations
  • Prompts
  • Warning dialogs

Alerts are simpler than modals and usually contain:

  • A title
  • A message
  • One or more buttons
  • Optional input fields

Example: Simple Alert

const alert = await this.alertCtrl.create({
  header: 'Warning',
  message: 'Are you sure you want to delete?',
  buttons: ['Cancel', 'Yes']
});

await alert.present();

Key Features:

  • Easy to configure
  • Auto-styled for iOS and Android
  • Supports multiple buttons and handler functions
  • Supports text inputs (prompts)

Use ion-alert when you need a simple, quick dialog rather than a full modal UI.

24. What is the difference between ion-list and ion-item?

ion-list and ion-item are complementary but serve different purposes.

ion-list

  • A container used to group multiple list items.
  • Provides proper padding, border styling, and list behavior.
  • Used for menus, settings pages, chats, contacts, etc.

Example:

<ion-list>
  <ion-item>Item 1</ion-item>
  <ion-item>Item 2</ion-item>
</ion-list>

ion-item

  • Represents a single row inside a list.
  • Can contain:
    • icons
    • labels
    • toggles
    • avatars
    • buttons
    • inputs

Example:

<ion-item>
  <ion-label>Name</ion-label>
  <ion-input></ion-input>
</ion-item>

Summary:

ComponentPurposeion-listA container for grouping multiple list rowsion-itemA single interactive row inside a list

You almost always use ion-item inside ion-list.

25. Explain how to use ion-tabs.

ion-tabs is used to create tab-based navigation similar to many mobile apps (Instagram, WhatsApp bottom tabs).

Tabs allow users to switch between major sections of the app without losing the state of each tab.

Basic Structure

<ion-tabs>
  <ion-tab-bar slot="bottom">
    <ion-tab-button tab="home">
      <ion-icon name="home"></ion-icon>
      <ion-label>Home</ion-label>
    </ion-tab-button>

    <ion-tab-button tab="settings">
      <ion-icon name="settings"></ion-icon>
      <ion-label>Settings</ion-label>
    </ion-tab-button>
  </ion-tab-bar>
</ion-tabs>

Routing for tabs

Each tab corresponds to a route:

const routes: Routes = [
  {
    path: 'tabs',
    component: TabsPage,
    children: [
      { path: 'home', loadChildren: () => import('./home/home.module').then(m => m.HomePageModule) },
      { path: 'settings', loadChildren: () => import('./settings/settings.module').then(m => m.SettingsPageModule) }
    ]
  }
];

Benefits of ion-tabs:

  • Persistent navigation bar.
  • Each tab maintains its own navigation stack.
  • Smooth and intuitive UX.

Tabs are ideal for organizing major app sections in a user-friendly manner.

26. What is theming in Ionic?

Theming in Ionic refers to customizing the look and feel of the entire application using:

  • CSS variables
  • Global styles
  • Color palettes
  • Dark and light themes

1. Theme Variables

Located in:

src/theme/variables.scss

Defines:

  • Primary color
  • Secondary color
  • Success, warning, danger
  • Typography rules

Example:

:root {
  --ion-color-primary: #3880ff;
  --ion-color-secondary: #5260ff;
}

2. Dark Mode

Ionic supports automatic or manual dark mode:

@media (prefers-color-scheme: dark) {
  :root {
    --ion-background-color: #000;
  }
}

3. Component-Level Styling

Each component can override theme variables.

Why theming is important:

  • Ensures a unified brand identity.
  • Enhances UX.
  • Easy to apply consistent styling across platforms.

27. What is ion-refresher and when is it used?

ion-refresher allows users to pull down from the top of a page to refresh the content—similar to the refresh gesture in mobile apps like Gmail or Instagram.

Example usage:

<ion-content>
  <ion-refresher (ionRefresh)="doRefresh($event)">
    <ion-refresher-content></ion-refresher-content>
  </ion-refresher>
</ion-content>

In TypeScript:

doRefresh(event) {
  setTimeout(() => {
    event.target.complete();
  }, 1000);
}

Used when:

  • Fetching new data (APIs)
  • Refreshing feed, list, or dashboard
  • Reloading user content

It enhances mobile user experience significantly and provides a natural, expected gesture for refreshing data.

28. What is ion-infinite-scroll?

ion-infinite-scroll loads more data automatically when the user scrolls to the bottom of a list.

Perfect for:

  • Social media feeds
  • News apps
  • Chat apps
  • Large list views

Example:

<ion-content>
  <ion-list>
    <ion-item *ngFor="let item of items">{{ item }}</ion-item>
  </ion-list>

  <ion-infinite-scroll (ionInfinite)="loadMore($event)">
    <ion-infinite-scroll-content></ion-infinite-scroll-content>
  </ion-infinite-scroll>
</ion-content>

TypeScript:

loadMore(event) {
  setTimeout(() => {
    this.addMoreItems();
    event.target.complete();
  }, 1000);
}

Benefits:

  • Improves performance by loading data gradually.
  • Feels natural on mobile devices.
  • Reduces initial load time.

29. How do you apply global styles in Ionic?

Global styles allow you to apply CSS across the entire application.

Ionic provides two main files:

1. src/global.scss

Add global CSS rules, utility classes, and common styling.

Example:

.text-bold {
  font-weight: 700;
}

2. src/theme/variables.scss

Override Ionic theme variables, colors, spacing, fonts.

Example:

:root {
  --ion-font-family: 'Roboto';
}

Applying global styles also involves:

  • Declaring custom CSS variables
  • Overriding component-level CSS
  • Adding global resets

Ionic's global styling system ensures consistent branding and design across all app screens.

30. What is ion-loading?

ion-loading is a lightweight component used to show a spinner overlay while performing a background task such as:

  • API calls
  • Submitting forms
  • Processing data
  • Saving settings

It blocks user interaction temporarily and indicates progress.

Example usage:

const loading = await this.loadingCtrl.create({
  message: 'Please wait...',
  spinner: 'crescent'
});

await loading.present();

Dismiss it:

await loading.dismiss();

Features:

  • Automatically styled for iOS and Android.
  • Can be dismissed manually or after a timeout.
  • Customizable message and animation.

ion-loading improves UX by giving clear feedback that the system is busy.

31. How do you deploy an Ionic app to a device?

Deploying an Ionic app to a physical device involves using Capacitor and the platform’s native tools (Android Studio or Xcode).

Step 1: Build the Ionic project

ionic build

This creates a production-ready web build in the www/ folder, which Capacitor uses.

Step 2: Sync the build with native platforms

npx cap sync

This command copies the latest web build into the native Android/iOS projects.

Step 3: Open the native project

For Android:

npx cap open android

This opens the project in Android Studio, where you can:

  • Connect an Android device
  • Enable USB debugging
  • Click Run to install the app

For iOS:

npx cap open ios

This opens the project in Xcode, where you can:

  • Select a physical iPhone
  • Set signing & certificates
  • Click Run

Step 4: Deploy to the device

Once opened in Android Studio or Xcode, simply click:

  • Run ▶ for Android
  • Build & Run for iOS

Summary:

Deployment uses the native toolchain because Ionic apps become native apps via Capacitor.

32. How do you test an Ionic app in the browser?

Testing in the browser is one of the easiest ways to verify UI and logic instantly.

1. Using ionic serve

ionic serve

This:

  • Launches the app in a browser
  • Enables Live Reload (auto-refresh on code changes)
  • Simulates responsive device screens

2. Testing PWAs

ionic build

Then serve via a local HTTP server.

3. Using Chrome DevTools Device Mode

Press Ctrl + Shift + M to simulate:

  • Screen sizes
  • Touch gestures
  • Throttling
  • GPS simulation

4. Browser-based debugging

Use the console and network tab to verify:

  • API calls
  • Errors
  • Performance

Browser testing is fast and ideal for UI development before deploying to real devices.

33. What is ionic serve?

ionic serve is a CLI command used to run the Ionic application in a development server.

What it does:

  1. Starts a local web server
  2. Opens the app in your default browser
  3. Enables Live Reload, so any change in:
    • HTML
    • TypeScript
    • SCSS
    automatically refreshes the app.

Command:

ionic serve

Features:

  • Allows rapid UI development
  • Shows real-time changes
  • Provides debugging via browser tools
  • Supports custom ports (e.g., ionic serve --port=8101)

Why it is important:

It significantly speeds up development since you don’t need to rebuild the app for every minor change.

34. What is the purpose of config.xml in Cordova projects?

config.xml is the central configuration file used in Cordova-based Ionic apps (before Capacitor became the default).

Functions of config.xml:

1. App Metadata

  • App name
  • App ID (package id)
  • Version number

2. Platform-specific preferences

Example:

<preference name="Orientation" value="portrait" />

3. Plugin configuration

  • Installing plugins
  • Setting plugin variables

4. App icons and splash screens

Defines paths for assets on both Android and iOS.

5. Whitelist settings

Defines which domains the app can access.

Relevance Today

  • Capacitor does not use config.xml.
  • Still relevant only if maintaining old Ionic+Cordova apps.

35. What is the difference between hybrid and native apps?

Hybrid and native apps differ in development approach, technology, and performance characteristics.

Native Apps

Built with platform-specific languages:

  • Swift/Objective-C → iOS
  • Kotlin/Java → Android

Advantages:

  • Best performance
  • Direct access to native APIs
  • Superior UI/UX experience

Disadvantages:

  • Separate codebases required for iOS and Android
  • Expensive development & maintenance

Hybrid Apps

Built using web technologies (HTML, CSS, JS) and wrapped inside a native container (WebView).

Frameworks:

  • Ionic
  • Cordova
  • Capacitor

Advantages:

  • Single codebase for iOS, Android, and Web
  • Faster development
  • Cost-effective

Disadvantages:

  • Slightly lower performance than pure native apps
  • Heavy graphics (games) not ideal

Summary:

FeatureNativeHybridPerformanceHighestModerate–HighCodebaseSeparate (iOS & Android)SingleDevelopment costHighLowUIPlatform-specificWeb-basedMaintenanceHarderEasier

Ionic apps fall into the hybrid category, but with modern WebView performance they feel almost native.

36. How does Ionic integrate with native device features?

Ionic integrates with native device features using Capacitor, which serves as a bridge between JavaScript and native code.

How It Works:

  1. Ionic runs in a WebView inside a native app.
  2. Capacitor provides Plugins that expose native APIs to JavaScript.
  3. JavaScript calls → Capacitor → native Android/iOS APIs → returns data.

Example: Using the Camera

import { Camera } from '@capacitor/camera';

const photo = await Camera.getPhoto({
  quality: 90,
  resultType: 'base64'
});

Built-in Capacitor Plugins:

  • Camera
  • Geolocation
  • Filesystem
  • Storage
  • Haptics
  • Share
  • Toast
  • Push notifications

You can also create custom native plugins using Swift/Kotlin.

This makes Ionic apps capable of accessing nearly all native features like a fully native app.

37. What are plugins in Ionic?

Plugins are reusable modules that provide access to native device features.

These plugins allow JavaScript to interact with:

  • Camera
  • GPS
  • Bluetooth
  • File storage
  • Biometric sensors
  • Push notifications

Types of Plugins:

1. Capacitor Plugins (recommended)

Provided by Capacitor:

  • Modern
  • Type-safe
  • Actively maintained

Example:

npm install @capacitor/camera

2. Community Plugins

Provided by third-party developers.

3. Custom Native Plugins

Written in Swift/Kotlin when custom functionality is needed.

Plugin Workflow:

  1. Install plugin
  2. Sync with native code (npx cap sync)
  3. Call plugin methods in JavaScript

Plugins provide the key functionality that makes hybrid apps behave like real native apps.

38. What is a web view?

A WebView is a native component used to run web content (HTML, CSS, JS) inside a mobile application.

In Ionic applications, the WebView acts as the container that displays the app UI, powered by the device’s browser engine.

WebView Engines:

  • UIWebView/WKWebView → iOS
  • Chromium WebView → Android

Role of WebView in Ionic:

  • Renders the entire UI of the Ionic app
  • Executes JavaScript
  • Communicates with native APIs via Capacitor
  • Provides near-native performance

Why WebView matters:

Ionic apps are fundamentally web apps running inside a native shell, but with access to native features.

This is what makes Ionic a hybrid framework.

39. How do you debug an Ionic app on Android/iOS?

Debugging Ionic apps involves using browser tools and platform-specific debugging tools.

1. Debugging in Browser

Use:

  • Chrome DevTools
  • Firefox DevTools

2. Debugging on Android

Steps:

  1. Connect Android device via USB
  2. Enable USB Debugging
  3. Run app:
ionic capacitor run android -l

Open Chrome and navigate:

chrome://inspect

You can:

  • View console logs
  • Inspect HTML & CSS
  • Analyze network requests

3. Debugging on iOS

Steps:

  1. Open project in Xcode
  2. Run app on device
  3. Open Safari → Develop Menu → Select device
  4. Inspect WebView content

4. Debugging Native Code

Use:

  • Android Studio Logcat
  • Xcode Console & Breakpoints

5. Debugging Plugins

Add logging in native plugin files (Swift/Kotlin).

40. How do you build APK/IPA using Ionic?

Building an installable app package requires Capacitor + native toolchain.

Build APK (Android)

Step 1: Build web assets

ionic build

Step 2: Sync with Capacitor

npx cap sync android

Step 3: Open in Android Studio

npx cap open android

Step 4: Build APK

Android Studio →
Build → Build Bundle(s) / APK(s) → Build APK

You get:

  • debug.apk
  • release.apk

Build IPA (iOS)

Step 1: Build web assets

ionic build

Step 2: Sync

npx cap sync ios

Step 3: Open in Xcode

npx cap open ios

Step 4: Set signing & capabilities

Step 5: Build IPA

Xcode →
Product → Archive → Distribute App

You can upload to TestFlight or export an .ipa.

Notes:

  • IPA requires macOS + Xcode
  • APK can be built on Windows/Linux/macOS
  • For App Store/Play Store deployment, extra signing steps are required

Intermediate (Q&A)

1. Explain the Ionic and Angular integration architecture.

Ionic integrates with Angular using a layered architecture that combines:

1. Ionic Framework (UI Layer)

Ionic provides a rich set of Web Components built using Stencil.js. These components (ion-button, ion-input, ion-header, etc.) render:

  • Native-like UI
  • Platform-specific theming (iOS/Material Design)
  • Gesture and animation handling

These components are framework-agnostic, but Ionic Angular wraps them in Angular modules.

2. Angular Application Layer

Angular provides:

  • Components
  • Modules
  • Routing
  • Dependency Injection
  • Forms (Reactive + Template-driven)
  • HTTPClient for APIs

This layer is responsible for business logic, state management, services, and data flow.

3. Ionic Angular Integration Layer

Ionic provides Angular bindings:

  • IonicModule
  • IonicRouteStrategy (for route reuse)
  • ion-router-outlet (extends Angular router-outlet with animations)
  • Lifecycle hooks (ionViewDidEnter, etc.)

This layer bridges Angular’s SPA model with Ionic’s mobile navigation patterns.

4. Capacitor Runtime Layer (Native Bridge)

Ionic apps run inside a native shell using Capacitor, which provides:

  • WebView runtime
  • Native API access
  • Plugin architecture
  • Platform controls (Android/iOS/Web)

In Summary

LayerResponsibilityIonic UI ComponentsVisual UI + cross-platform lookAngular FrameworkApp logic + routing + DIIonic Angular BridgeGlue between Angular + Ionic navigationCapacitorNative device integration

This layered architecture creates a powerful hybrid framework combining the best of Angular and native mobile capabilities.

2. How does Capacitor manage native platforms?

Capacitor treats each native platform as a first-class project, not a generated artifact like Cordova.

1. Native Projects Live Alongside Web Code

When you run:

npx cap add android
npx cap add ios

Capacitor creates real native projects that developers can open with:

  • Android Studio
  • Xcode

These projects stay synchronized with web code using:

npx cap sync

2. Capacitor JavaScript–Native Bridge

Capacitor maintains a real-time bridge that connects:

  • JavaScript running inside WebView
  • Native code in Swift/Kotlin

The bridge is fast, modern, and promise-based.

3. Plugins

Native functionality is packaged into plugins, which Capacitor manages by:

  • Installing plugin JS code
  • Registering native code in Android/iOS
  • Automatically generating TypeScript typings

4. Platform-Specific Code Allowed

Developers can customize:

  • AndroidManifest.xml
  • Gradle files
  • plist configuration
  • Swift/Kotlin code

Unlike Cordova, Capacitor does not overwrite your changes.

5. Build Process

Capacitor does not build APK/IPA itself—platform toolchains do:

  • Android Studio → APK/AAB
  • Xcode → IPA

Capacitor only supplies the WebView + bridge.

3. Explain Capacitor plugin architecture.

Capacitor plugins are modular pieces of code that enable Ionic apps to access native functionality.

Plugin Architecture Components

1. JavaScript API

Every plugin exposes a JS API like:

import { Camera } from '@capacitor/camera';
Camera.getPhoto();

These APIs return Promises, not callbacks.

2. Native Implementations

Each plugin may implement native code in:

  • Swift (iOS)
  • Kotlin/Java (Android)
  • Web implementation (optional)

Capacitor automatically selects the correct implementation.

3. Plugin Manifest (capacitor.config.ts)

Defines:

  • Plugin settings
  • Permissions
  • Configuration options

4. Web Fallback

If a device lacks a native API, plugins can provide web-based implementations.

Example: Camera fallback uses file input on browser.

5. Registration System

Plugins register automatically with Capacitor using decorators or configuration entries.

6. Custom Plugins

Developers can create custom plugins when:

  • A native feature is unavailable
  • Performance-critical code is needed
  • Integrating third-party SDKs

This flexibility makes Capacitor highly extensible and future-proof.

4. How do you handle authentication in Ionic apps?

Authentication in Ionic can be implemented in several ways depending on your backend and requirements.

1. JWT Authentication

Most common approach:

  • User enters email/password
  • Backend returns JWT token
  • Store token using Ionic Storage or Capacitor Preferences
  • Attach token in every HTTP request
  • Verify token expiry

Example:

localStorage.setItem('token', jwt);

2. OAuth 2.0 / Social Logins

Using providers like:

  • Google
  • Facebook
  • Apple Sign-In

Use Capacitor plugins for deep linking and secure authentication flows.

3. Firebase Authentication

Firebase provides:

  • Email/password auth
  • Social login
  • Phone authentication
  • Anonymous login

Perfect for Ionic because Firebase supports WebView-based apps.

4. Route Guards

Protect pages using Angular’s CanActivate.

canActivate() {
  return this.authService.isLoggedIn();
}

5. Token Refresh

Implement refresh_token logic for long-lived sessions.

6. Backend Security Considerations

  • Use HTTPS
  • Validate tokens server-side
  • Secure sensitive data with Capacitor Secure Storage

Authentication in Ionic mirrors web app authentication, with mobile-specific enhancements for token storage and deep linking.

5. What is routing in Ionic Angular and how does it differ from navigation in Ionic v3?

Routing in Ionic Angular is based on Angular Router, whereas Ionic v3 used a stack-based navigation controller.

Ionic v3 (old)

  • Used NavController
  • Navigation was stack-based (push/pop)
  • Not URL-driven (bad for deep linking)
  • Lazy loading relied on decorators

Example:

this.navCtrl.push('DetailsPage');

Ionic Angular (modern)

Uses Angular Router:

<ion-button routerLink="/details">Details</ion-button>

Advantages:

  1. URL-driven routing (supports deep linking)
  2. Native Angular navigation animations
  3. Lazy loading via Angular modules
  4. Better SEO for PWAs
  5. More scalable

ion-router-outlet

Extends Angular’s router-outlet with:

  • Page transition animations
  • Swipe-back gestures
  • Stack preservation per tab

Summary:

FeatureIonic v3Ionic AngularNavigationStack-basedURL-basedRouterCustomAngular RouterLazy LoadingDecoratorsStandard AngularDeep LinkingLimitedFull supportPWAsWeakStrong

Modern Ionic apps rely entirely on Angular routing for scalable navigation.

6. How do you implement lazy loading in Ionic Angular?

Lazy loading helps load pages only when needed, improving performance.

Step 1: Create a lazy-loaded module

ionic generate module pages/home --routing
ionic generate page pages/home

This creates:

home/
  home.module.ts
  home-routing.module.ts

Step 2: Configure routing

In home-routing.module.ts:

const routes: Routes = [
  { path: '', component: HomePage }
];

Step 3: Add the lazy-loaded route in app-routing

{
  path: 'home',
  loadChildren: () => import('./pages/home/home.module')
    .then(m => m.HomePageModule)
}

Benefits of lazy loading:

  • Decreases initial load time
  • Improves mobile performance
  • Loads modules only when entered
  • Enhances overall UX

Lazy loading is essential for real-world Ionic production apps.

7. Explain the working of IonSlides.

IonSlides is a component built on top of Swiper.js, enabling swipeable content areas such as intro screens, galleries, or product carousels.

How It Works

1. Initialization

When ion-slides loads, it initializes a Swiper instance with configuration options such as:

  • Autoplay
  • Loop
  • Pagination
  • Slide effects
  • Speed

2. Slide Structure

<ion-slides [options]="slideOpts">
  <ion-slide>Slide 1</ion-slide>
  <ion-slide>Slide 2</ion-slide>
</ion-slides>

3. Navigation & Events

You can control slides via methods:

this.slides.slideNext();
this.slides.slidePrev();
this.slides.getActiveIndex();

Events like:

  • ionSlideDidChange
  • ionSlideWillChange

allow tracking user movement.

4. Swiper Engine

Swiper provides:

  • Touch/swipe gestures
  • Momentum
  • Looping
  • Virtual slides (high performance)
  • Pagination and scrollbar

Ionic wraps Swiper to match its design and animation system.

8. How do you optimize an Ionic app for performance?

Performance optimization is essential for smooth mobile experience.

1. Enable Lazy Loading

Loads pages only when needed.

2. Use Ionic Virtual Scroll

Improves rendering for long lists.

3. Minimize DOM elements

Large DOM trees slow down WebView rendering.

4. Optimize Images

  • Use compressed images
  • Use correct sizes
  • Use ion-img for lazy loading

5. Cache API Responses

  • Use Ionic Storage
  • Reduce network requests

6. Avoid unnecessary Angular change detection

Use:

ChangeDetectionStrategy.OnPush

7. Production Build

ionic build --prod

This enables:

  • Minification
  • Tree shaking
  • Ahead-of-Time (AoT) compilation

8. Remove console.log in production

9. Avoid too many animations

Heavy animations degrade FPS on low-end devices.

10. Use Web Workers for CPU-intensive tasks

9. What are custom Ionic themes?

Custom Ionic themes are user-defined color schemes, typography, and styling variables applied across the entire app to match brand identity.

Custom themes involve:

1. Setting CSS Variables

In variables.scss:

:root {
  --ion-color-primary: #1a73e8;
  --ion-color-secondary: #ff9900;
}

2. Creating New Color Palettes

.ion-color-gold {
  --ion-color-base: #e7b500;
  --ion-color-contrast: #fff;
}

3. Typography Customization

:root {
  --ion-font-family: 'Roboto';
}

4. Dark Mode Themes

@media (prefers-color-scheme: dark) {
  :root {
    --ion-background-color: #000;
  }
}

Custom themes allow:

  • Brand alignment
  • Global UI consistency
  • Reusable style components

Ionic’s CSS variable system makes theming extremely flexible without complex CSS overrides.

10. How does Ionic handle responsive UI?

Ionic handles responsiveness using a combination of:

1. Ion Grid

A 12-column responsive grid system that adapts across:

  • xs
  • sm
  • md
  • lg
  • xl

2. CSS Utilities

Ionic provides utility classes for:

  • Padding
  • Margin
  • Display (flex, block)
  • Text alignment

Example:

<div class="ion-padding ion-text-center"></div>

3. Adaptive Components

Components auto-adjust their styling based on:

  • Platform (iOS vs Android)
  • Screen size
  • Orientation

4. Media Queries

Developers can add custom breakpoints in global.scss:

@media (min-width: 768px) {
  .desktop-only {
    display: block;
  }
}

5. Split Pane

Allows side menu to automatically become sidebar on tablets:

<ion-split-pane contentId="main">
  <ion-menu></ion-menu>
  <div id="main"></div>
</ion-split-pane>

6. Platform Detection

Using Ionic’s Platform service:

if (this.platform.is('tablet')) { ... }

Conclusion

Ionic’s responsive system ensures apps adapt effortlessly to:

  • Android
  • iOS
  • Tablets
  • Desktop PWAs

11. Explain media queries vs Ionic utilities.

Media queries and Ionic utilities both support responsive design, but they work differently and serve different purposes.

Media Queries

Media queries are CSS rules that apply styles based on device characteristics like:

  • Screen width
  • Orientation
  • Resolution

Example:

@media (min-width: 768px) {
  .desktop-layout {
    display: flex;
  }
}

Advantages of Media Queries

  • Very flexible
  • Native CSS (no dependency)
  • Great for custom responsive layouts

Disadvantages

  • Requires writing manual CSS
  • Can become complex for large apps

Ionic Utilities

Ionic utilities are pre-built CSS helper classes that simplify styling.

Example utility classes:

<div class="ion-padding ion-text-center"></div>

Common utilities include:

  • Spacing utilities (ion-margin, ion-padding)
  • Text utilities (ion-text-center)
  • Display utilities (ion-hide, ion-show-md)
  • Flex helpers

Ionic Responsive Breakpoints

Ionic provides platform-aware classes:

  • .ion-hide-sm-down
  • .ion-show-lg
  • .ion-hide-md-up

Example:

<div class="ion-hide-md-down">Shown on mobile only</div>

Key Differences

FeatureMedia QueriesIonic UtilitiesTypeCSS rulesHelper classesFlexibilityVery highModerateLearning curveHigherEasyUse CaseCustom layoutsQuick styling & responsiveness

Use both together for advanced responsive layouts in real-world apps.

12. What is a service in Angular and how is it used in Ionic?

A service in Angular is a singleton class designed to handle reusable logic such as:

  • API calls
  • Authentication
  • State management
  • Data caching
  • Utility functions

Angular services follow the Dependency Injection (DI) model.

Creating a Service

ionic generate service services/user

This creates:

@Injectable({
  providedIn: 'root'
})
export class UserService {
  getUser() { ... }
}

The providedIn: 'root' ensures it is a singleton shared across all pages.

Using a Service in Ionic

Inject it into a page/component:

constructor(private userService: UserService) {}

ngOnInit() {
  this.userService.getUser();
}

Why Services Are Important in Ionic

  • Maintain separation of concerns
  • Reuse logic across multiple pages
  • Improve testability
  • Centralize API handling
  • Enable global state (e.g., AuthService)

Services are the backbone of business logic in both Angular and Ionic apps.

13. How do you use HttpClient inside Ionic for API calls?

Ionic Angular uses Angular’s built-in HttpClient module to make HTTP requests.

Step 1: Import HttpClientModule

In app.module.ts:

import { HttpClientModule } from '@angular/common/http';

@NgModule({
  imports: [HttpClientModule]
})
export class AppModule {}

Step 2: Inject HttpClient into a service

constructor(private http: HttpClient) {}

Step 3: Make API Calls

GET Request

getUsers() {
  return this.http.get('https://api.example.com/users');
}

POST Request

login(data) {
  return this.http.post('https://api.example.com/login', data);
}

PUT / DELETE

updateUser(id, user) {
  return this.http.put(`https://api.example.com/users/${id}`, user);
}

Step 4: Subscribe in Component

this.userService.getUsers().subscribe(response => {
  console.log(response);
});

Features of HttpClient:

  • Observables support
  • Interceptors
  • Error handling
  • Base URL configurability
  • Headers, params, and authentication

HttpClient is the most important tool for connecting Ionic apps to backend APIs.

14. What are interceptors and how are they used in Ionic?

Interceptors are Angular middleware that "intercept" HTTP requests and responses globally.

They are powerful for:

  • Attaching authentication tokens
  • Adding custom headers
  • Logging HTTP traffic
  • Global error handling
  • Retrying requests
  • Transforming responses

Creating an Interceptor

ionic generate interceptor token

Example: Add Authorization Token

intercept(req: HttpRequest<any>, next: HttpHandler) {
  const token = localStorage.getItem('token');

  const cloned = req.clone({
    setHeaders: {
      Authorization: `Bearer ${token}`
    }
  });

  return next.handle(cloned);
}

Register Interceptor

In app.module.ts:

providers: [
  {
    provide: HTTP_INTERCEPTORS,
    useClass: TokenInterceptor,
    multi: true
  }
]

Benefits of Interceptors

  • Cleaner code (no need to set headers in every request)
  • Centralized authentication handling
  • Ability to catch 401/403 errors
  • Perfect for Ionic apps using JWT

15. How do you persist data in Ionic using Storage or Preferences?

Ionic provides two main storage systems:

1. Ionic Storage (for structured and offline data)

Supports:

  • IndexedDB
  • SQLite (via Capacitor)
  • LocalStorage

Automatically chooses best engine available.

Setup

npm install @ionic/storage-angular

In app.module.ts:

imports: [
  IonicStorageModule.forRoot()
]

Usage

await this.storage.set('token', 'abc123');

const token = await this.storage.get('token');

Best For:

  • Caching API data
  • Saving session tokens
  • Offline content

2. Capacitor Preferences (simple key-value storage)

Lightweight but more secure than localStorage.

Usage

import { Preferences } from '@capacitor/preferences';

await Preferences.set({
  key: 'user',
  value: JSON.stringify({ name: 'John' })
});

const user = await Preferences.get({ key: 'user' });

Best For:

  • User settings
  • Flags (e.g., onboarding completed)
  • Small persistent values

Comparison

FeatureIonic StorageCapacitor PreferencesData SizeLargeSmallStorage EnginesIndexedDB, SQLiteOS Key-Value StoreUse CaseOffline appsSimple settings

16. How do you use Capacitor Camera API?

The Capacitor Camera API allows accessing the device camera or photo gallery.

Step 1: Install Camera Plugin

npm install @capacitor/camera
npx cap sync

Step 2: Use Camera in Code

import { Camera, CameraResultType } from '@capacitor/camera';

async takePhoto() {
  const image = await Camera.getPhoto({
    quality: 90,
    resultType: CameraResultType.Base64,
    source: 'CAMERA'
  });

  this.photo = 'data:image/jpeg;base64,' + image.base64String;
}

Settings you can configure:

  • Quality (0–100)
  • Source: 'CAMERA' or 'PHOTOS'
  • Editing allowed
  • Orientation correction
  • Output type (URI, Base64, Blob)

Step 3: App Permissions

Android and iOS require camera permissions configured in:

  • AndroidManifest.xml
  • Info.plist

Camera API is used for:

  • Uploading profile pictures
  • Scanning documents
  • Barcode scanning
  • AR features

17. What is the purpose of WebView in Ionic?

WebView is the native container that runs the Ionic app.

What WebView does:

  • Renders HTML/CSS
  • Executes JavaScript
  • Acts as the "browser inside the app"
  • Bridges web code to native code via Capacitor

Different WebViews:

PlatformWebViewAndroidChromium WebViewiOSWKWebView

Why WebView matters:

  1. Ionic apps are hybrid apps—WebView renders UI.
  2. Capacitor uses WebView to inject native plugins.
  3. Performance depends heavily on WebView quality.
  4. Enables cross-platform rendering with a single codebase.

Without WebView, Ionic apps cannot run.

18. What is ion-virtual-scroll?

ion-virtual-scroll is a performance optimization technique for large lists.

What it does:

It renders only the visible items on the screen, not the entire list.

Example:
If you have 10,000 items, maybe only 12–20 are rendered at once.

Usage Example

<ion-virtual-scroll [items]="users" approxItemHeight="50px">
  <ion-item *virtualItem="let user">
    {{ user.name }}
  </ion-item>
</ion-virtual-scroll>

Benefits:

  • Dramatically improves performance
  • Smooth scrolling
  • Ideal for chat apps, feeds, large datasets

Requirements:

  • Estimated item height (approxItemHeight)
  • Items should have stable sizes

19. How do you implement push notifications in Ionic?

Push notifications in Ionic use Capacitor + Firebase Cloud Messaging (FCM).

Step 1: Install Push Notification Plugin

npm install @capacitor/push-notifications

Step 2: Register for permissions

import { PushNotifications } from '@capacitor/push-notifications';

PushNotifications.requestPermissions().then(result => {
  if (result.receive === 'granted') {
    PushNotifications.register();
  }
});

Step 3: Listen for notifications

PushNotifications.addListener('pushNotificationReceived', notification => {
  console.log('Notification received:', notification);
});

Step 4: Use Firebase for actual delivery

  • Android → uses FCM
  • iOS → uses APNs (via Firebase)

Set up Firebase project and download config files:

  • google-services.json for Android
  • GoogleService-Info.plist for iOS

Step 5: Send notifications using Firebase server

20. What are gestures in Ionic?

Ionic provides a Gesture Controller for implementing custom touch interactions such as:

  • Swipes
  • Pinches
  • Taps
  • Long press
  • Dragging
  • Sliding

Using Gesture API

import { GestureController } from '@ionic/angular';

const gesture = this.gestureCtrl.create({
  el: myElement,
  gestureName: 'swipe-gesture',
  onMove: ev => console.log('Moving', ev),
  onEnd: ev => console.log('Ended', ev)
});

gesture.enable(true);

Built-in Gestures:

  • Swipe to go back
  • Pull-to-refresh
  • Slides / Carousels
  • Side menu swipe
  • Segment slider

Features of Ionic Gestures:

  • High performance (based on Pointer Events)
  • Works across platforms
  • Prevents browser scrolling conflicts
  • Smooth mobile animations

Gestures allow Ionic apps to feel interactive, fast, and truly mobile-native.

21. Explain the difference between IonNav and Angular Router.

IonNav and Angular Router are two different navigation mechanisms in Ionic, but they serve different architectural styles.

IonNav (Stack-based Navigation – Legacy / Rarely Used Now)

IonNav mimics a native mobile navigation stack:

  • Uses push() to navigate forward
  • Uses pop() to go back
  • Similar to Ionic v3
  • No URL routing (not SEO-friendly)
  • Manually controls navigation stacks

Example:

this.nav.push(DetailPage);

Pros

  • Great for custom, dynamic navigation flows
  • Works like native navigation UIs

Cons

  • Not URL-driven → no deep links
  • Harder to maintain
  • Not ideal for Angular architecture

Angular Router (Modern Routing System)

Angular Router is the official navigation system for Ionic Angular apps.

It uses URL-based routing, like any Angular SPA:

<ion-button routerLink="/details">Go</ion-button>

Pros

  • URL-driven navigation
  • Supports lazy loading
  • Supports deep links
  • State preserved in tabs
  • Built-in Guards (auth, role-based access)
  • More scalable

Cons

  • Has a learning curve for mobile devs
  • Needs proper routing structure

Which one should you use?

For modern Ionic Angular apps → ALWAYS use Angular Router

For advanced, customized navigation stacks → use IonNav

Ionic team officially recommends avoiding IonNav unless you have a special requirement.

22. How do you handle app state management in Ionic?

State management handles how data flows across the entire app, especially when dealing with:

  • Authentication
  • User preferences
  • API data
  • UI state
  • Offline data

Depending on the app’s size, Ionic provides multiple strategies.

1. Using Angular Services (Simple Apps)

Services store state in memory:

@Injectable({ providedIn: 'root' })
export class AuthService {
  isLoggedIn = false;
}

All components use the same instance (singleton).
Best for small apps.

2. Using RxJS BehaviorSubjects (Medium Apps)

user$ = new BehaviorSubject(null);

Every component can subscribe to updates.

Benefits:

  • Reactive UI updates
  • Cleaner code
  • Good for cart, user profile, dashboard

3. Using NgRx / Akita / NGXS (Large Apps)

These libraries implement Redux-style global store.

Benefits:

  • Predictable state
  • Time-travel debugging
  • Actions + Reducers architecture
  • Works extremely well with Ionic lazy modules

Used for enterprise apps with huge datasets.

4. Persistent State

Use:

  • Ionic Storage
  • Capacitor Preferences
  • Secure Storage

Example:

await Storage.set({ key: 'user', value: JSON.stringify(user) });

5. Hybrid State (Memory + Local Storage + API Sync)

Often used for:

  • Offline-first apps
  • Mobile banking
  • eCommerce apps

In Summary

App SizeState ManagementSmallAngular serviceMediumRxJS subjectsLargeNgRx / NGXS / AkitaOfflineStorage + caching

23. What is NgZone and why is it important in hybrid apps?

NgZone is Angular’s mechanism for managing change detection in asynchronous operations.

Hybrid apps can run outside Angular’s normal zone because native plugins (Camera, Geolocation, FileSystem) execute outside Angular's change detection.

What does NgZone solve?

For example, when calling Capacitor:

Camera.getPhoto().then(photo => {
  this.image = photo;  // Angular may NOT update UI automatically
});

Native code runs outside Angular’s zone, so Angular won’t detect variable changes.

Using NgZone

constructor(private zone: NgZone) {}

Camera.getPhoto().then(photo => {
  this.zone.run(() => {
    this.image = photo;
  });
});

Why NgZone is critical in hybrid apps:

  1. Ensures UI updates after native plugin calls
  2. Prevents inconsistent UI state
  3. Improves app responsiveness
  4. Ensures Angular’s change detection triggers correctly

Without NgZone, hybrid apps may show stale UI or fail to update data.

24. Explain the Ionic build process.

Ionic’s build process prepares your app for deployment on Android, iOS, or Web.

Step 1: TypeScript Compilation

Angular compiles .ts.js
Includes:

  • AOT (Ahead-of-Time)
  • Tree shaking
  • Minification

Step 2: Web Assets Generation

Output stored in:

/www

This folder contains:

  • HTML
  • CSS
  • JavaScript bundles
  • Images

This is the final "web app".

Step 3: Capacitor Sync

npx cap sync

Copies the /www build into:

  • android/app/src/main/assets/public/
  • ios/App/public/

Step 4: Native Build (Android/iOS)

Android Studio → APK/AAB

Xcode → IPA

Capacitor does not build the app itself; it hands off to the native toolchains.

Bonus: ionic build --prod

Enables:

  • Ahead-of-Time compilation
  • Minification
  • Compression
  • Dead code elimination

This makes mobile apps much faster.

25. How do you integrate Firebase with Ionic?

Firebase is used for:

  • Authentication
  • Firestore database
  • Push notifications
  • Cloud Functions
  • Storage

Step 1: Install Firebase

npm install firebase

Step 2: Add Firebase Configuration

In environment.ts:

export const environment = {
  firebaseConfig: {
    apiKey: "...",
    authDomain: "...",
    projectId: "...",
    storageBucket: "...",
    messagingSenderId: "...",
    appId: "..."
  }
};

Step 3: Initialize Firebase

import { initializeApp } from 'firebase/app';

const app = initializeApp(environment.firebaseConfig);

Using Firebase Services:

Authentication

import { getAuth, signInWithEmailAndPassword } from 'firebase/auth';

Firestore

import { getFirestore, doc, setDoc } from 'firebase/firestore';

Cloud Storage

import { getStorage, uploadBytes } from 'firebase/storage';

Push Notifications

Use:

npm install @capacitor/push-notifications

Then connect Firebase Cloud Messaging (FCM).

26. What is deep linking in Ionic apps?

Deep linking allows users to open a specific screen in the app using a URL.

Example link:

myapp://product/123

Opens directly to product page.

Two Types of Deep Linking:

1. Internal Deep Linking (Angular Router)

Browser-style navigation:

/product/12

Used for PWAs and web-based navigation.

2. External Deep Linking (App Links / Universal Links)

Allows:

  • Opening app from SMS
  • Opening app from email
  • Opening app from other apps
  • Opening app from QR codes
  • Opening app from browser

How It Works in Ionic (Capacitor):

Install App URL plugin:

npm install @capacitor/app

Listen for URL opens:

App.addListener('appUrlOpen', (event) => {
  console.log(event.url);
});

Benefits:

  • Enhances onboarding
  • Improves navigation
  • Supports marketing campaigns
  • Enables deep share links

27. What is PWAs support in Ionic?

Ionic has first-class support for Progressive Web Apps (PWAs).

A PWA is a web app that behaves like a native app.

Ionic provides:

1. Service Workers

Enable:

  • Offline caching
  • Faster loading
  • Background operations

2. Responsive UI

Ionic UI components scale to desktop, tablet, and mobile.

3. Manifest.json

Allows installation on home screen.

4. Modern Web Features

  • Push notifications
  • Background sync
  • WebShare API
  • Storage API

Why Ionic is great for PWAs:

  • Same codebase → Web + Android + iOS
  • Lightning-fast UI due to Web Components
  • Strong Angular integration

Ionic is considered one of the best frameworks for PWAs.

28. How do you enable offline mode in Ionic apps?

Offline mode ensures the app works without internet.

1. Use Ionic Storage / SQLite

Cache API responses locally.

2. Use Service Workers

Enable through Angular PWA package:

ng add @angular/pwa

They handle:

  • Asset caching
  • API caching
  • Offline routing

3. Use Firestore Offline Support

Firebase Firestore has built-in offline mode.

4. Detect Network Changes

import { Network } from '@capacitor/network';

5. Local Queues for Offline Sync

If API fails → store request → sync later.

6. Use Local-first Architecture

App reads from cache first → updates when online.

Offline is essential for:

  • Field apps
  • Delivery apps
  • Medical apps
  • Rural area apps

29. How do you secure API keys in Ionic apps?

Because Ionic apps run in WebView, API keys can be exposed if not secured.

1. Store keys on backend (BEST PRACTICE)

Do NOT store sensitive keys in the app.
Use a backend proxy like:

Ionic app → Backend → Third-party API

2. Use Environment Variables

But remember: This is NOT fully secure for secret keys.

3. Use Capacitor Secure Storage Plugin

Encrypts data using OS keychain:

SecureStoragePlugin.set({ key: 'apikey', value: '123' });

4. App Store / Play Store configuration

Some APIs support “key restrictions”:

  • Domain restrictions
  • Package name restrictions
  • SHA fingerprint restrictions

5. Obfuscation

Use JavaScript obfuscation to make reverse engineering harder.

6. Validate requests server-side

Ensure tokens cannot be used outside your app.

30. What is the difference between ionic build, ionic serve, ionic capacitor run?

These three commands serve different purposes.

1. ionic serve

Runs the app in browser.

ionic serve

Features:

  • Live Reload
  • Fast development cycle
  • No native features (camera, push, etc.)

Used in early development stages.

2. ionic build

Builds production-ready web assets.

ionic build

This outputs the app into the:

/www

folder.

Used for:

  • Capacitor sync
  • Publishing PWAs
  • Creating production bundles

3. ionic capacitor run

Runs the app on Android/iOS devices or emulators.

Example:

ionic capacitor run android

Features:

  • Opens Android Studio or Xcode
  • Allows device deployment
  • Supports Live Reload (-l --external)
  • Access to native plugins

Summary Table

CommandPurposePlatformionic serveBrowser dev serverWeb onlyionic buildCreate web buildAll (Android, iOS, Web)ionic capacitor runRun on device with native supportAndroid / iOS

31. How do you manage environment files in Ionic?

Environment files allow you to separate development, staging, and production configuration settings — such as API URLs, keys, and feature flags.

Ionic uses Angular’s environment system.

1. Default Environment Files

Inside src/environments/ you get:

environment.ts          → Development
environment.prod.ts     → Production

2. Define Variables

Example (environment.ts):

export const environment = {
  production: false,
  apiUrl: 'https://dev.example.com/api',
  firebaseConfig: {...}
};

Example (environment.prod.ts):

export const environment = {
  production: true,
  apiUrl: 'https://api.example.com',
  firebaseConfig: {...}
};

3. Using Environment Variables

import { environment } from '../environments/environment';

this.http.get(environment.apiUrl + '/users');

4. Build with Environment Switching

Angular will automatically use the correct environment based on the build command:

Development:

ionic serve

Uses environment.ts

Production:

ionic build --prod

Uses environment.prod.ts

5. Adding Custom Environments

ng generate environment staging

Then include in angular.json under fileReplacements.

Why this matters?

  • Cleaner code
  • No hardcoded URLs
  • Easy staging/testing
  • Better security

Environment files are essential for scalable real-world Ionic applications.

32. How do you debug Capacitor plugins?

Debugging Capacitor plugins involves debugging JavaScript, Android native code, and iOS native code, because plugins run on all three layers.

1. Debug JavaScript Plugin Layer

Use console.log() in the JS implementation:

console.log('Plugin input:', data);

Inspect using browser DevTools or device inspector.

2. Debug Android Plugin Code

  1. Open Android Studio:
npx cap open android

Use Logcat:

Log.d("MyPlugin", "Debug message");
  1. Set breakpoints in Kotlin/Java code
  2. Attach debugger to running app

3. Debug iOS Plugin Code

  1. Open Xcode:
npx cap open ios

Insert debug logs:

print("Plugin executed: \(value)")
  1. Use Xcode debugger
  2. Set Swift breakpoints

4. Debug Plugin Bridge Communication

Enable verbose logging:

window.Capacitor.Plugins.MyPlugin.echo({ val: "Hello" });

Check:

  • If plugin registered correctly
  • If JS → native mapping is correct
  • If plugin methods return expected data

5. Test Web Implementation

Plugins may have fallback web versions — use browser DevTools.

Debugging Strategy

LayerToolJavaScriptConsole + DevToolsAndroidLogcat + breakpointsiOSXcode debuggerBridgeCapacitor logs

33. What is ion-skeleton-text used for?

ion-skeleton-text is used to show placeholder loading animations while actual content is being fetched from the server.

It mimics:

  • Text lines
  • Blocks
  • Cards
  • Images

This improves perceived performance and avoids blank white screens.

Example Usage

<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 90%"></ion-skeleton-text>

Features

  • Beautiful pulsing animation
  • Looks like modern apps (Facebook, LinkedIn, Instagram)
  • Auto-adjusts size based on applied styles
  • Great for lists and cards

Use Cases

  • While waiting for HTTP requests
  • While rendering lists
  • While loading dashboard data

Skeleton UI improves user experience significantly in data-heavy Ionic apps.

WeCP Team
Team @WeCP
WeCP is a leading talent assessment platform that helps companies streamline their recruitment and L&D process by evaluating candidates' skills through tailored assessments