eatthecode.com

Angular Shared Library

angular shared library description

Angular shared library definitions and illustration

Angular shared library allows you to share logic betwen different applications easly, with giving you the ability to reduce code duplications and its issues.

Angular shared library illustration

Creating the library

Creating the library is important when u need to share logic between different applications, or when you need to mitigate the issues of code duplications. Shared library can help also in sharing code with other developers in same project, company or in another places.

Steps for building the angular shared library

1- Generate the library project

        ng g lib my-lib

2- Generate component

          ng g c dashboard --project my-lib

Add your logic in the dashboard component as what you need. Then

3- Build the library

        ng build my-lib --prod

4- Test the library

        ng s --o

The above command will produce a .tgz file which you can use in any other projects

6- Usage

In any another project you need to use the library add the . tgz file at project root then run the following command

          npm install file.tgz

Enjoy…!!!

We can help you to build such as software tools/snipts, you contact us from here

Exit mobile version