Questions tagged [angular-library]

Angular library is a means for building general solutions that can be adapted for re-use in different apps. They also can be published and shared as npm packages.

Angular library is a means for building general solutions that can be adapted for re-use in different apps. They also can be published and shared as npm packages. https://angular.io/guide/libraries

629 questions
6
votes
2 answers

Angular library bundle local dependency

I have two libraries: core and client. Core is meant to be private and client is the one to be published. I want to include core inside client bundle (client uses core functions), so the final user does not need to manage core dependency. ¿How can I…
adrisons
  • 3,443
  • 3
  • 32
  • 48
6
votes
0 answers

Add extension methods in Angular 11 library

Some time ago I created two simple file to extend functionalities for some types. I created a global.d.ts in this way: export { } declare global { interface Date { isLeapYear() : boolean; } interface Array { …
erikscandola
  • 2,854
  • 2
  • 17
  • 24
6
votes
0 answers

Angular Library without a workspace

I'm trying to develop a new library that I intend to pull into three new Angular apps, as well as several components that extend one that comes from the library and are then used by those three apps. In my head the natural structure for this is a…
Craig
  • 8,093
  • 8
  • 42
  • 74
6
votes
1 answer

Angular APP_INITIALIZER in library module generates metadata compile time error: Lambda not supported

This is my ng library module code @NgModule({ imports: [NgIdleModule.forRoot()], providers: [ { provide: APP_INITIALIZER, useFactory: (idleStateChangeHandlerService: IdleStateChangeHandlerService) => () =>…
jenson-button-event
  • 18,101
  • 11
  • 89
  • 155
6
votes
5 answers

NullInjectorError: No provider for ElementRef

I created an internal directive in a module in my project (Angular 8 + Material Design). Following tuto and official doc. @Directive({ selector: '[button-confirmation]' }) export class ButtonConfirmationDirective { @Output('bc-confirm') …
6
votes
1 answer

How to fix ng build error when renaming public_api.ts to public-api.ts in angular8 upgrade

I am in the middle of migrating angular 7 to angular 8 for my company's component library that was built with 'ng generate library '. I tried to be as close to standard angular cli build as possible. I created a brand new app and a library with…
Annie Huang
  • 161
  • 1
  • 7
6
votes
2 answers

How can I locally develop Angular 7 libraries that depend on each other? (npm link issues)

I have two angular library NPM packages: A has basic components A-BC has components that build upon the components in A, with added features to integrate with BC library Some components in A-BC import from A like import { MyThing } from…
Paul
  • 817
  • 1
  • 10
  • 25
6
votes
2 answers

How to create an angular library that intercepts http requests made from my app

I am trying to create an angular library that intercepts http requests from the app it is imported in. The issue is that the interceptor doesn't work if it is imported from the library but if I move it inside my app it is working. the interceptor…
Andrei
  • 148
  • 1
  • 6
6
votes
1 answer

Custom angular 7 library with ionic 4 - Can't resolve '../@ionic/angular/dist/core.ngfactory' build prod error

We have built small angular 7/ionic 4 library that we want to use in multiple projects internally by installing through git url. Serving the project works correctly, all imports from library work fine. But when running ng build --prod I get the…
6
votes
2 answers

How to consume a service from Angular Library in a project

I have a Angular 6 project which import an angular library. I import components from library successfully, and now I'd like to have the AuthGuard Service in library, to share in all projects, but I can't do it. I exported the AuthGuard in lib's…
Rachel
  • 103
  • 1
  • 5
6
votes
4 answers

Angular serve library

In latest versions of Angular cli, we can use ng g library lib-name command to create library. As mentioned in the Angular docs : ng serve And: The name of the project to build. Can be an app or a library. So, we can serve…
Vahid Najafi
  • 4,654
  • 11
  • 43
  • 88
6
votes
3 answers

Angular 6 library pipe

How to add a custom pipe in an Angular 6 library in order for it to be available in my main app ? Currently I'm doing this in: lib.module.ts: @NgModule({ declarations: [ SomePipe ], exports: [ SomePipe ]}) in public_api.ts: export *…
6
votes
1 answer

Angular six set initial value for @Output EventEmitter

I have a component