0
Error: src/app/shared/pages/scan-qr/scan-qr.module.ts:16:5 - error NG6002: 'SharedComponentsModule' does not appear to be a NgModule class.

 SharedComponentsModule,
   ~~~~~~~~~~~~~~~~~~~~~~
src/app/shared/components/shared-components.module.ts:113:14
113 export class SharedComponentsModule {}
                 ~~~~~~~~~~~~~~~~~~~~~~
Is it missing an @NgModule annotation?

This is my app.modules.ts

import { HttpClient, HttpClientModule } from '@angular/common/http';
import { Injector, NgModule } from '@angular/core';
import { AngularFireModule } from '@angular/fire';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { FaIconLibrary, FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { fab } from '@fortawesome/free-brands-svg-icons';
import { far } from '@fortawesome/free-regular-svg-icons';
import { fas } from '@fortawesome/free-solid-svg-icons';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { firebaseConfig } from 'src/environments/environment';
import '~lib/extensions/string';
import { ServiceLocator } from '~lib/helpers/service-locator';
import { SharedComponentsModule } from '~shared/components/shared-components.module';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
import { FileChooser } from '@ionic-native/file-chooser/ngx';
import { SocialLoginModule, SocialAuthServiceConfig } from 'angularx-social-login';
import {File} from '@ionic-native/file/ngx';
import { GoogleLoginProvider } from 'angularx-social-login';
import {Base64} from "@ionic-native/base64/ngx";
import { AgmCoreModule } from '@agm/core';
import { env } from '~lib/helpers/env';
import { NgxCaptureModule } from 'ngx-capture';
/**
 * Loader para las traducciones.
 */
export function translateLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, '/assets/i18n/', '.json');
}

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    FormsModule,
    IonicModule.forRoot({ mode: 'md' }),
    AppRoutingModule,
    SharedComponentsModule,
    HttpClientModule,
    NgxCaptureModule,
     
    TranslateModule.forRoot({
      defaultLanguage: 'es',
      loader: {
        provide: TranslateLoader,
        useFactory: translateLoaderFactory,
        deps: [HttpClient],
      },
    }),
AngularFireModule.initializeApp(firebaseConfig),
AngularFireAuthModule,
AngularFirestoreModule,
FontAwesomeModule,
BrowserAnimationsModule,
SocialLoginModule,
 ],


providers: [
    GooglePlus,
    FileChooser,File,Base64,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
    {
      provide: 'SocialAuthServiceConfig',
      useValue: {
        autoLogin: false,
        providers: [
           
           
        ],
      } as SocialAuthServiceConfig,
    },
  ],
  bootstrap: [AppComponent],
})

export class AppModule {
  
  constructor(library: FaIconLibrary, private injector: Injector) {
    library.addIconPacks(fas, far, fab);
    ServiceLocator.injector = injector;
  }

}

Here is code for scan module

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { SharedComponentsModule } from '~shared/components/shared-components.module';

import { ScanQrPageRoutingModule } from './scan-qr-routing.module';
import { ScanQrPage } from './scan-qr.page';

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,

    SharedComponentsModule,
   ScanQrPageRoutingModule,
  ],
  declarations: [ScanQrPage],
})
export class ScanQrPageModule {}

Here is sharedComponentModule

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { SharedDirectivesModule } from '~shared/directives/shared-directives.module';
import { AddToCartModalComponent } from './add-to-cart-modal/add-to-cart-modal.component';
import { CommentsModalComponent } from './comments-modal/comments-modal.component';
import { QrCodeModalComponent } from './qr-code-modal/qr-code-modal.component';
import { RatingModalComponent } from './rating-modal/rating-modal.component';
import { ChattingModalComponent } from './chatting-modal/chatting-modal.component';
import { AddToCartCustomerModalComponent } from './add-to-cart-customer-modal/add-to-cart-customer-modal.component';
import {ScanQrPageModule} from './../pages/scan-qr/scan-qr.module'
import { BackButtonFallbackComponent } from './back-button-fallback/back-button-fallback.component';
import { ContextCardComponent } from './context-card/context-card.component';
import { CustomerItemComponent } from './customer-item/customer-item.component';
import { ElapsedTimeCounterComponent } from './elapsed-time-counter/elapsed-time-counter.component';
import { FormInputComponent } from './form-input/form-input.component';
import { IconButtonComponent } from './icon-button/icon-button.component';
import { MenuItemComponent } from './menu-item/menu-item.component';
import { NotificationItemComponent } from './notification-item/notification-item.component';
import { OrderCardComponent } from './order-card/order-card.component';
import { OrderCardCustomerComponent } from './order-card-customer/order-card-customer.component';
import { BookingCardCustomerComponent } from './booking-card-customer/booking-card-customer.component';
import { OrderProductItemComponent } from './order-product-item/order-product-item.component';
import { OrderProductsModalComponent } from './order-products-modal/order-products-modal.component';
import { PaymentModalComponent } from './payment-modal/payment-modal.component';
import { ProductItemComponent } from './product-item/product-item.component';
import { ProductsFilteringModalComponent } from './products-filtering-modal/products-filtering-modal.component';
import { SectionCardComponent } from './section-card/section-card.component';
import { CustomerSectionCardComponent } from './customer-section-card/customer-section-card.component';
import { AccordionComponent } from './accordion/accordion.component';
import {IonicRatingComponent} from 'ionic-rating-component';



@NgModule({
  declarations: [
     MenuItemComponent,
    FormInputComponent,
    SectionCardComponent,
    CustomerSectionCardComponent,
    OrderProductItemComponent,
    AddToCartModalComponent,
    CommentsModalComponent,
    QrCodeModalComponent,
    RatingModalComponent,
    ChattingModalComponent,
    AccordionComponent,
    AddToCartCustomerModalComponent,
    OrderCardComponent,
    OrderCardCustomerComponent,
    BookingCardCustomerComponent,
    OrderProductsModalComponent,
    PaymentModalComponent,
    IconButtonComponent,
    BackButtonFallbackComponent,
    NotificationItemComponent,
    CustomerItemComponent,
    ProductItemComponent,
    ProductsFilteringModalComponent,
    ContextCardComponent,
    ElapsedTimeCounterComponent,
    IonicRatingComponent
    //
  ],
  imports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    IonicModule,
    FontAwesomeModule,
    TranslateModule,
     SharedDirectivesModule,
  ],
  exports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    IonicModule,
    FontAwesomeModule,
    TranslateModule,
     SharedDirectivesModule,
    MenuItemComponent,
    FormInputComponent,
    SectionCardComponent,
    CustomerSectionCardComponent,
    OrderProductItemComponent,
    AddToCartModalComponent,
    CommentsModalComponent,
    QrCodeModalComponent,
    RatingModalComponent,
    ChattingModalComponent,
    AccordionComponent,
    AddToCartCustomerModalComponent,
    OrderCardComponent,
    OrderCardCustomerComponent,
    BookingCardCustomerComponent,
    OrderProductsModalComponent,
    PaymentModalComponent,
    IconButtonComponent,
    BackButtonFallbackComponent,
    NotificationItemComponent,
    CustomerItemComponent,
    ProductItemComponent,
    ProductsFilteringModalComponent,
    ContextCardComponent,
    ElapsedTimeCounterComponent,
    IonicRatingComponent
  ],
})
export class SharedComponentsModule {}
Amit Sharma
  • 1,775
  • 3
  • 11
  • 20
  • 1
    Please share the code for scan-qr.module.ts as well as SharedComponentsModule. – 31piy Jul 06 '23 at 07:35
  • @31piy added. please check – Amit Sharma Jul 06 '23 at 07:37
  • 1
    If you're on angular 14+ I recommend using standalone components. If you're still using NgModules you can import the component as if it was a module that exports that component. Share your SharedComponentsModule please. As the error says "Is it missing an @NgModule annotation?" – Andrew Allen Jul 06 '23 at 07:38
  • I won't be able to make a lot of changes at this stage. @AndrewAllen. Please see attached sharedcomponent module – Amit Sharma Jul 06 '23 at 07:47
  • 1
    This line in your `SharedComponentsModule` file, `import {ScanQrPageModule} from './../pages/scan-qr/scan-qr.module'` looks suspicious. Circular reference and unused import – Andrew Allen Jul 06 '23 at 07:54
  • @AndrewAllen I have added this line while testing. removing this line does not help either – Amit Sharma Jul 06 '23 at 07:58
  • 1
    wow... your module is so big.... – Random Jul 06 '23 at 08:10
  • thanks for the response it was the Ionic rating component in the shared component that is causing the issue. – Amit Sharma Jul 17 '23 at 06:47

0 Answers0