Skip to content

Instantly share code, notes, and snippets.

@Ademking
Created July 22, 2018 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ademking/d4856f4e64c65c80b90ab602ad3f18ae to your computer and use it in GitHub Desktop.
Save Ademking/d4856f4e64c65c80b90ab602ad3f18ae to your computer and use it in GitHub Desktop.
πŸ’™ Ionic 3 : Add custom HTML Tag to your app - Solution

To use custom tags (in my example A-frame) :

<a-scene>
      <a-sky src="https://i.imgur.com/dneNDgI.jpg" rotation="0 -20 0"></a-sky>
    </a-scene>

in your app.module.ts :

  1. add CUSTOM_ELEMENTS_SCHEMA :
import { ErrorHandler, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
  1. add schemas: [ CUSTOM_ELEMENTS_SCHEMA ] in @NgModule :
@NgModule({
  declarations: [
    MyApp,
    HomePage
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ],
  schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment