Skip to content

sanjeetkumaritoutlook/ionic-web-app

Repository files navigation

create a web application using Ionic!

Ionic is a popular framework for building cross-platform mobile and web applications. It's based on web technologies like HTML, CSS, and JavaScript, and allows you to create native-like experiences for both mobile and desktop platforms. Here’s how you can use Ionic to create a web application:

Steps to Create a Web Application with Ionic:

  1. Install Ionic CLI: First, you need to install the Ionic Command Line Interface (CLI) globally if you haven't already:
npm install -g @ionic/cli

Create a New Ionic Project:

After installing the CLI, you can create a new project using the following command. You can choose different templates such as blank, tabs, or sidemenu based on your app's requirements.

ionic start ionic-web-app 

it will ask Javascript framework to choose (this is done with angular standalone)

Signup

https://dashboard.ionicframework.com/signup?source=cli https://ionic.io/signup?source=cli Continue with Github

Go to your new project:

  • cd .\ionic-web-app

  • Run ionic serve within the app directory to see your app in the browser

  • Run ionic capacitor add to add a native iOS or Android project using Capacitor

  • Generate your app icon and splash screens using cordova-res --skip-config --copy

  • Explore the Ionic docs for components, tutorials, and more: https://ion.link/docs

  • Building an enterprise app? Ionic has Enterprise Support and Features: https://ion.link/enterprise-edition

(Angular with Ionic ) app loads by default:

http://localhost:8100/home

home.page.html loads first

Create Pages:

Use the Ionic CLI to generate new pages (standalone components):

ionic generate page my-page

routing

Configure route in home.page.html itself

 <ion-button routerLink="/app-home">New home</ion-button>
  <ion-button routerLink="/home">Old home</ion-button>

Index.html shows

But in app.routes.ts, home is configured as default If routing to be implemented then Ensure RouterModule is Properly Imported

If you are using standalone components, ensure the RouterModule is included in the root component:

In home.component.ts

Navigate to Your Project Folder: After the project is created, navigate into the project folder: Run the Web Application: You can run the app in your browser using the following command:

ionic serve

Build for Web:

Once your app is ready, you can build it for production:

ionic build –prod

Ionic's Web Features:

• Responsive Design: Ionic uses responsive grid systems and components that adapt well to both mobile and desktop screen sizes. • Progressive Web Apps (PWA) Support: Ionic allows you to build Progressive Web Apps with offline capabilities, push notifications, and a native-like feel on the web. • Web Components: Ionic leverages Web Components to create reusable UI components that work across all platforms. • Ionic is a great choice for building web applications, especially if you want to also target mobile platforms (iOS and Android) using the same codebase. You can easily create a web app using Ionic by following the above steps, and then deploy it as a static website or a PWA.

Ionic Angular app

Except app component( app.component.html , app.component.ts) all new components/pages are like this: home.page.html, home.page.ts

Page vs Components

pages and components serve different purposes, and the decision to generate a page or a component depends on the role the entity will play in your app. Here’s why you typically generate a page rather than a component in this scenario:

Pages are Routed Views

A page in Ionic is essentially a full-screen view that is navigable via the Angular Router. Pages are meant to represent distinct screens in your application (e.g., Home, About, Profile, etc.). When you generate a page, it comes with built-in support for Angular routing, including integration with the RouterModule and ion-router-outlet.

ionic generate page my-page

Components are Reusable UI Elements

A component is typically a smaller, reusable part of the UI (e.g., a button, a card, or a list item). Components are not routable and are meant to be used inside pages or other components. Components do not have built-in support for routing or navigation.

ionic generate component my-component

Use a component when:

You need reusable UI elements (e.g., a custom button, a card, or a list). The element does not require routing or navigation. You want to include the element in multiple pages.

About

Ionic Angular app starts at localhost 8100 , ionic serve

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published