Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Ionic angular component

$
0
0

@Theophilejr wrote:

Hello everyone !
I’m actually using ionic 4 and trying to use a angular component named : menu;
First; I added the component in everypage’s module to use it; it said that It was repeated in a few modules and I needed to create a global module (for components) and add it to the pages;
I did it; error :

ERROR Error: Uncaught (in promise): Error: Template parse errors: 'app-menu' is not a known element: 1. If 'app-menu' is an Angular component, then verify that it is part of this module. 2. If 'app-menu' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" </ion-fab> </div> [ERROR ->]<app-menu></app-menu> </ion-content> "): ng:///MapPageModule/MapPage.html@14:3 Error: Template parse errors: 'app-menu' is not a known element: 1. If 'app-menu' is an Angular component, then verify that it is part of this module. 2. If 'app-menu' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" </ion-fab> </div> [ERROR ->]<app-menu></app-menu> </ion-content> "): ng:///MapPageModule/MapPage.html@14:3 at TemplateParser.prototype.parse (http://localhost:8100/vendor.js:27163:13) at JitCompiler.prototype._parseTemplate (http://localhost:8100/vendor.js:32729:9) at JitCompiler.prototype._compileTemplate (http://localhost:8100/vendor.js:32716:9) at Anonymous function (http://localhost:8100/vendor.js:32659:49) at Set.prototype.forEach (native code) at JitCompiler.prototype._compileComponents (http://localhost:8100/vendor.js:32659:9) at Anonymous function (http://localhost:8100/vendor.js:32569:13) at SyncAsync.then (http://localhost:8100/vendor.js:8979:34) at JitCompiler.prototype._compileModuleAndComponents (http://localhost:8100/vendor.js:32568:9) at JitCompiler.prototype.compileModuleAsync (http://localhost:8100/vendor.js:32528:9)

App-module.ts :

  declarations: [AppComponent],
  entryComponents: [MenuComponent],
  imports: [BrowserModule, IonicModule.forRoot(),
   AppRoutingModule,
   AngularFireModule.initializeApp(environment.firebase),
   AngularFirestoreModule,
   AngularFireAuthModule,
  ComponentsModule],
  providers: [
    StatusBar,
    SplashScreen,
    Firebase,
    Geolocation,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

components.module.ts: ```
import { NgModule } from ‘@angular/core’;
import { CommonModule } from ‘@angular/common’;
import { MenuComponent } from ‘…/menu/menu.component’;
@NgModule({
declarations: [MenuComponent],
imports: [
CommonModule
],
exports: [MenuComponent]
})
export class ComponentsModule { }

And I add id like that : 
(example page) parameters.module.ts : ```
@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    ComponentsModule,
    RouterModule.forChild(routes)
  ],
  entryComponents: [],
  declarations: [ParametersPage],
})

I even remember it said too ’ isn’t a known element’, I just changed menu’s html to simply “text”, will
correct this later.
Please help me to add this menu in my pages; I really would appreciate it.
Thanks so much (ionic is making me crazy…)
Have a nice day !

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>