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.

Filter by
Sorted by
Tagged with
0
votes
0answers
17 views

Load one module from Angular Library Instead of loading the whole library

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 ...
0
votes
1answer
22 views

How to use baseUrl for absolute import statements in a library?

I have a library with a workspace containing two projects, one for the library itself and one for a test application. ├── projects    ├── midi-app    └── midi-lib In the workspace tsconfig.json ...
0
votes
0answers
30 views

Invalid path in Angular library

I am using Angular library and have the following folder structure: coollibrary - components - my.component.ts - services - my.service.ts public_api.ts In public_api, I export the ...
0
votes
1answer
10 views

How to fix ng build <lib> 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. ...
1
vote
0answers
17 views

Building Scoped NPM Packages Excludes Scope Prefix For Peer Dependency Imports

I create a scope using npm init [email protected] as depicted here and follow the subsequent commands. My library makes use of two peer dependencies (which are built and installed). After the library is ...
0
votes
0answers
38 views

Angular library structure [closed]

As in Angular project, We Consider a structure that is comprised of (core/shared/feature) modules، is it possible to use this structure in the Angualr library; that we can generate a library like ...
1
vote
0answers
20 views

Jsonpath doesn't work when used out of Angular Library Bundle

I have a project where I'm creating an Angular Library, that is imported in another app as a UMD bundle. I wanted to use Jsonpath library to parse json in one of the components in the library. When I ...
0
votes
1answer
59 views

Angular-library issue while including in another separate project

I'm trying to create an angular-library and export it as @nivite/nlib. the library itself has a test project which build builds happily with ng build --prod But when I create a separate app and try ...
0
votes
1answer
12 views

Building external JS (not TS) files in Angular Library with ng build?

I built an Angular component library using the Angular CLI (for libraries), and one of my components is importing and using a local JS file. However, when I "ng build", only the TS files are bundled ...
0
votes
1answer
41 views

How to include SASS styles in an angular 8 library

I had an angular library for sharing some components, directives and more between two projects. Recently I tried to include in the library some styles to reuse in the two projects but I can achieve ...
0
votes
0answers
16 views

Exporting a node module with a component library in Angular?

I made a component library using the Angular CLI and I have have a separate test application that imports this library. The component library builds nicely, but I am having trouble running "ng serve"...
0
votes
1answer
28 views

How to use service inside import decorator for angular module config?

I want to method in service for module config, but module is loaded from decorator, and service is not DI yet. How to use service inside load module? I use this answer for example For example method ...
0
votes
0answers
30 views

Unable to ng build lib with .html files

I am using angular cli v 7.2.0. to package a lib project. I am getting the error: my-lib/src/core/plugins/cart/basketPlugin.ts: (error) TS2307: Cannot find module './basketPlugin.html'. The ...
0
votes
1answer
31 views

Injecting data from custom component library to its services

I'm working on a custom Angular component library that will need to be configured with some parameters when added to other Angular projects. This library needs to be configured with some parameters ...
0
votes
0answers
25 views

Error When Building AOT Mode, on my Custom NPM Library

I get an error when I ng build --aot. The error message is: "ERROR in ./src/app/app.module.ngfactory.js" "Module not found: Error: Can't resolve 'customlib' in 'D:\Project\test-app\' Is Anything ...
0
votes
0answers
15 views

How Can I Pass An Instance Of A Service To A Component Within A Library In Angular?

I have a component library that I am building that has multiple shared components what perform various tasks. I have a new need that is a bit more complex and needs a service provided from the parent ...
0
votes
0answers
9 views

Domsanitizer of library

I have a library project that needs Domsanitizer to properly function. I am consuming this library from my app. I think I should be able to instantiate my library component without importing ...
0
votes
1answer
44 views

Best practices to hide comunication between component and service in an Angular library

I'm creating an Angular library that allow to show messages inside a component's template and it's composed by a 'MessagesService' that is used to set messages and a 'MessagesComponent', used to show ...
1
vote
2answers
54 views

SVG component in Angular library project gives 'Unknown word' error

I am creating a npm library package in Angular 8.1.3 If I add an SVG file as a component template in the library project then the build command ng build <project-name> gives my-comp.component....
2
votes
1answer
30 views

Angular library: configure exported members

How can I define the exported members of my Angular library? I am using the public-api.ts file, containing: export * from './lib/my-lib.module'; But when importing the library to a module, the ...
2
votes
1answer
38 views

How to apply custom CSS styles of Angular library within a host application?

I have built an Angular library containing a styles.css file with some custom CSS. When I include the library in a test application in the same repository it works fine: library-repo/ ├── projects/ │ ...
0
votes
0answers
82 views

Dependency injection issues after upgrade to Angular 8

I have an Angular project that contains a web application and a library, both generated by the Angular CLI. To explain my issue, I broke it down to make it as simple as possible. Assume that the ...
1
vote
1answer
66 views

Web Worker in Angular Library

I'm developing an angular library that perform strong computation operations. So I was interested in implementing the web worker in order to have a better user experience and let the complex ...
0
votes
0answers
11 views

Is there a library to build a folder structure like s3 Bucket?

I want to build a folder structure in my app like the one that s3 bucket has. What I mean is: I have a list of folders. When I click on one of them, another view appears with the list of what the ...
-1
votes
1answer
31 views

How to expose bin javascript files out of Angular Library

I am creating a library, which exposes some bin scripts to the user, which he then can use in his build process. However I have truble with exposing such scripts to a dist package. My package.json ...
3
votes
1answer
126 views

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 ...
8
votes
2answers
244 views

How to have absolute import paths in a library project?

I have a library with a workspace containing two projects, one for the library itself and one for a test application. ├── projects    ├── midi-app    └── midi-lib In the workspace tsconfig.json ...
2
votes
0answers
44 views

How to include global styles in custom angular library

I have a running Angular 7 application and I am trying to create custom control library.I have some global styles that needs to be imported into the Angular application from this control library. I ...
0
votes
0answers
45 views

Angular services are not so singleton

I'm developping an Angular7 app. In my project, I've several libraries some of them containing services. Let's say I've a service called NotificatorService in a library called lib-controls import { ...
0
votes
0answers
40 views

Packaging issues with barrels in angular 7 library

I am trying to create a library with multiple modules in it. My library structure is as below. I have multiple modules like common-ui. Problem 1 I have the module and i have index.ts files in each ...
0
votes
1answer
31 views

Use Angular Library Locally In New/Separate Application

I am trying to include a library I built in a new application. It builds successfully but I get an error on runtime main.ts:13 Error: inject() must be called from an injection context. When I grab ...
0
votes
0answers
28 views

Can you use an Angular Library created Angular V7 with an Angular V6 application?

Are angular libraries generated with v7 of Angular CLI backwards compatible with an Angular 6 App? Also if we create a library with the beta version of Angular 8 cli will that be backwards compatible ...
0
votes
1answer
112 views

NG-ZORRO - override default style in library

I have an Angular library, packaged by ng-packagr, which wraps the NzTableComponent. I need to provide a custom style, by overriding default ones, for example @table-border-radius-base: 5px; @table-...
1
vote
0answers
37 views

Can a library generated with Angular-CLI 8 be safely used with an Angular 2, 4, 5, 6 or 7 application?

I develop and provide an Angular library through NPM. This library is currently being built by some hand made scripts when Angular 5 was the norm. This library has no problematic peerDependancies (...
0
votes
1answer
31 views

Load multiple components using routing in an angular library

I am trying to create module in library which will have different components and which can be based on routes, But issue faced while testing the library is , its not able to find and route to the ...
0
votes
2answers
86 views

How to share angular library without NPM

I'm developing a component library which I don't want to share in npmjs, is there any way to share my angular library with other angular projects with out sharing it with NPM.
2
votes
0answers
66 views

How to hide services from public_api.ts in Angular library

I'm looking to make a shared Angular (7.2.15) library, and only expose abstract classes I'm using as interfaces in the public_api.ts. However, I keep running into errors saying Cannot find module './...
0
votes
1answer
16 views

CSS file of a component within a library does not get loaded with the component in angular app

I have developed a library in an angular application (which is generated using angular cli) and the library contains a component with its own template file and stylesheet. However, when I load the ...
17
votes
1answer
270 views

Keeping version numbers in sync in angular library project package.json files

When building an Angular Library application, is there an automated way to keep the root level package.json and the library application's package.json (e.g. under projects/my-library) file versions in ...
2
votes
1answer
44 views

How to get environment from Angular Component as “Library”?

I'm creating Angular Library but have some problem about environment. I generated a application(parent) and library(child). How to get environment (it defined under parent) from child component that ...
1
vote
1answer
32 views

Could anyone of you please recommend me some angular-libraries that work perfectly with angular 7.2, which export html template with CSS to a PDF file

I tried using jsPDF and html2canvas which together take the screenshot of the webpage and generate PDF file. But I do not want an image to a PDF file. I want a library that converts the HTML with CSS ...
0
votes
0answers
23 views

How can i include assets with an Angular Library? (v 8.0)

Is there a way to include assets in an Angular Library, using the latest version of Angular? I've read some variants, but the answers were for Angular 6 and since then the CLI has improved.
0
votes
0answers
7 views

Error in Angular 6 Test coverage report Getting Function,branches,lines and statements undefined

I am getting this report while running. Test cases are running fine but the coverage report not showing the correct details All file count is 0 Statement,line,functions and branched is Undefined ng ...
0
votes
1answer
80 views

Error with moment js in angular 7 library

Error while trying to use the moment js in angular 7 library (Same is working in normal angular app) Steps to replicate: Create angular library ng generate library my-lib npm install moment --...
0
votes
1answer
29 views

Reference Hierarchy in Angular Library Components

I have a set of components that implemented in a Angular CLI Library, Component Organized like this: Project |--Components -----|lib -------Text-box -------Button -------Select -------Check-Box ------...
1
vote
1answer
33 views

Angular library dependency exposure

When developing an angular library, how do I hide my internal dependencies? I.e. when developing my lib, I did this: yarn add moment-es6 However, this should be only an internal dependency - I don'...
0
votes
0answers
53 views

Build self contained Angular 7 library with routes and install for use in Angular 2.4.8 application

We are testing the ability to take a small module from our angular 2 application (angular 2.4.8, javascript, webpack, gulp, babel) and package it as a javascript library built with the angular cli ...
1
vote
1answer
136 views

How to publish an Angular Shared library to private a git server

I've made an angular 6 library using ng generate library my-lib, and now I need to publish it, however it cannot go to NPM since its a private code. At my company we have a private git server and I ...
0
votes
0answers
29 views

Trying to create a own library for modals using ng-bootstrap

My aim is to create a own library which contains code modal just as ng-bootstrap contains I trying to same code which ng-bootstrap contains copied the modal folder and necessary folder required for ...
1
vote
0answers
49 views

Override string prototype function not compiling in angular lib

string-prototype.service.ts String.prototype.equals = equals; String.prototype.includes = includes; interface String { equals: typeof equals; includes: typeof includes; } function equals(a):...