I have an angular library that has been generated with the following command:
ng generate library cac-models
In this library, I have two modules named Admin and Client Module.When I'd like to use Admin module I have to load it like the following command and then import it:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { AdminModule } from 'cac-models'; //=> this line
@NgModule({
declarations: [AppComponent],
imports:
[
BrowserModule,
AdminModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
This way, Angular loads the whole library (both admin and client module), because I import AdminModule from cac-models.
I'd like to load only the Admin Module. like below:
import { AdminModule } from 'cac-models/lib/admin/admin.module'; // I get error
In this way, I get the following error
Module not found: Error: Can't resolve 'cac-models/lib/admin/admin.module'
Is it possible to do?