Trying to create a component.module.ts

I’m trying to create a shared component declaration. I’ve found some information and I’m doing the exactly the same and i still got the same error '‘app-loading-spinner’ is not a known element".

components.module.ts

import { NgModule } from '@angular/core';
import { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.component';

@NgModule({
  declarations: [
    LoadingSpinnerComponent,
  ],
  imports: [],
  exports: [
    LoadingSpinnerComponent,
  ]
})
export class ComponentsModule {}

app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { IonicStorageModule } from '@ionic/storage';
import {TranslateModule} from '@ngx-translate/core';
import { ComponentsModule } from './components/components.module';

@NgModule({
  declarations: [AppComponent,],
  entryComponents: [],
  imports: [
    BrowserModule, IonicModule.forRoot(), AppRoutingModule, 
    HttpClientModule, IonicStorageModule.forRoot(), 
    TranslateModule.forRoot(), ComponentsModule
  ],
  providers: [
    StatusBar,
    SplashScreen,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent,]
})
export class AppModule {}

I think that I’m missing something. If anyone could helped me.

Import your custom component module in app.module.ts file.

import { ComponentsModule } from ‘./components/components.module’;

imports: [
BrowserModule, IonicModule.forRoot(), AppRoutingModule,
HttpClientModule, IonicStorageModule.forRoot(),
TranslateModule.forRoot(), ComponentsModule
]

It’s done, if you take a look you can see it.

Okey, look fine. Is it working?

No, i still get the same error.

Import component module in which page in you wish to use.