0

Intially I have an angular project where I have used Angular Material, later I have added the Ionic Framework by this process(https://stack247.wordpress.com/2019/03/11/integrate-ionic-in-existing-angular-project/), but I am not able use Ionic components, even the console is not displaying any errors.

my app.module.ts

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

  imports[IonicModule]

HTML:

  <ion-badge color="primary">11</ion-badge>

2 Answers 2

1

To use Ionic components in an existing Angular project. Two easy steps:

  1. Add schemas: [ CUSTOM_ELEMENTS_SCHEMA ] to your module (app.module.ts)

Like so:

import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule({
  imports:      [ BrowserModule],
  declarations: [ AppComponent],
  bootstrap:    [ AppComponent ],
  schemas:      [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class AppModule { }
  1. Add a link to the CDN in your index.html

<script src="https://unpkg.com/@ionic/[email protected]/dist/ionic.js"></script>

Sign up to request clarification or add additional context in comments.

Comments

0

You can include ionic library in angular by following command:

npm install @ionic/angular@latest --save

ref https://ionicframework.com/docs/intro/cdn#ionic-angular

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.