user12674790
user12674790

Reputation:

Load one module of angular library

With the following command I generated a library named (cac-common)

ng generate library cac-common

In this library I have 2 modules:

cac-common-utility (ng generate module cac-common-utility  --project=cac-common)

cac-common-security (ng generate module cac-common-security  --project=cac-common)

When I want to use the cac-common-security module I have to import it in any module as below:

import { CacCommonSecurityModule } from 'cac-common';

...
imports:[ CacCommonSecurityModule ]
...

My question are:

1- the import above load the whole cac-common library or load only cac-common-security module ?

2- why I can not import the cac-common-security module like the following ?

import { CacCommonSecurityModule } from 'cac-common/lib/cac-common-security/cac-common-security.module';

Upvotes: 0

Views: 328

Answers (1)

Masoud Bimar
Masoud Bimar

Reputation: 7811

You Can use Library by Importing its modules.

Or importing a name that wrap and export all the modules in it.

If you import modules via relative path of its directory, the source of library always must be available. if you import by exported name, you can easily install it everywhere you want.

Upvotes: 1

Related Questions