I attempted to create a component with global scope, but encountered an error:
Uncaught Error: Can't export directive LanguageComponent from SharedModule as it was neither declared nor imported!
To address this, I included the component in ShareModule like this:
exports: [
LoaderComponent,
LanguageComponent
]
I also tried adding the component to core.module as a declaration, but that did not resolve the issue.
ShareModule structure:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LoaderComponent } from './loader/loader.component';
import {LanguageComponent} from "../language/language.component";
import {HiderPipe} from "../pipes/Hider";
@NgModule({
imports: [
CommonModule
],
declarations: [
LanguageComponent,
LoaderComponent,
HiderPipe
],
exports: [
LoaderComponent,
LanguageComponent,
HiderPipe
]
})
export class SharedModule { }
This module is only imported in the main core.module
like so:
@NgModule({
imports: [
SharedModule
],