Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build Angular 4 Component Library with the Angular CLI + ng-packagr + state mgmt?

Trying to wrap up my head around creating an angular node module that will have a state mgmt Ngrx.

I've been building node module using this guide: https://medium.com/@nikolasleblanc/building-an-angular-4-component-library-with-the-angular-cli-and-ng-packagr-53b2ade0701e

Currently stuck at introducing ngrx child state, so that when I download from NPM my module, I can somehow define for to be part of my main app state mgmt.

As I understand I can do this somehow going the root of using/setting up ModuleWithProviders

like image 250
Chris Tarasovs Avatar asked Dec 28 '17 22:12

Chris Tarasovs


People also ask

What are the 4 files created for every angular component?

Inside that directory, four files are created: A CSS file for the component styles. An HTML file for the component template. A TypeScript file with a component class named HeroDetailComponent .

What angular CLI command can be used to create a library?

The Purpose of Angular Libraries To create a library, we generate it by “ng generate” command, built it by “ng build” command, publish by “npm publish” command. To use a library we install it by “ng i “ command.


1 Answers

You can use yeoman generator to make your library seed and add the ngrx features or anything you want to add.

So ng-packagr is not necessary because the starter kit is prepared to compile AOT angular libraries by default.

like image 114
Rubén Soler Avatar answered Oct 14 '22 06:10

Rubén Soler