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
15
votes
5 answers

How can I localize my Angular 11 library?

I'm refactoring my Angular 11 application into libraries. My regular application is localized using @angular/localize as a dev dependency, so I have made use of the $localize directive in part of my code. I need to move this code with this directive…
Roddy of the Frozen Peas
  • 14,380
  • 9
  • 49
  • 99
15
votes
2 answers

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 operations run on the background. My problem is that…
15
votes
2 answers

How does one go about creating an Angular library wrapper for an existing Javascript library?

Suppose there exists a Javascript library written in plain Javascript and commonly used on vanilla, non-frameworked websites. How does one go about creating an Angular library that can easily be npm installed that would make the library seamless to…
CodyBugstein
  • 21,984
  • 61
  • 207
  • 363
14
votes
3 answers

Angular 6 display components of a lazy loaded module

I am having issues with loading a component from a lazy loaded module, using Angular 6. I created a library using the CLI - ng generate library @org/chat Updated angular.json file to include: "lazyModules": [ "dist/org/chat" ], and then loading…
dev7
  • 6,259
  • 6
  • 32
  • 65
14
votes
1 answer

Angular: Creating plugins for 3rd party packages (libraries)

I created Angular Library (ngx-wig) and I would like to provide an ability to extend its functionality by using plugins. What would be the best place to declare plugin in Angular? (may be something like myLibModule.forRoot(..)) and what type of…
Stepan Suvorov
  • 25,118
  • 26
  • 108
  • 176
13
votes
2 answers

Why do i need *public-api.ts* and also *exports*

I am new to angular, started writing my first library, containing components, services, directives. i listed my components, services, directives in the library's exports array, but still: When using the library form another library or…
Menahem
  • 3,974
  • 1
  • 28
  • 43
13
votes
1 answer

Angular call function inside forRoot method

The problem is that I'm calling a function inside forRoot method like this: app.module.ts import {environment} from '../environments/environment'; ... @NgModule({ imports: [ BrowserModule, MyModule.forRoot({ config: { …
ismaestro
  • 7,561
  • 8
  • 37
  • 50
12
votes
1 answer

How to add and install peer dependencies in Angular library

Now I am building Angular library for defining reusable components. I made a component named main-layout. I needed to use ngx-perfect-scrollbar in the component. I know how to add dependencies in Angular project. ng add [package name] or npm…
JS Guru
  • 343
  • 1
  • 3
  • 11
12
votes
2 answers

How Do I Debug An Angular 7 Library in Visual Code

Is it possible to use Visual Studio Code Debugger to debug an Angular Library that has been linked using npm link? Very specifically I am wondering if I can link the debugger to my library's TypeScript Code (not the built js code). My debugger works…
11
votes
1 answer

Using React Component in Angular 2

I have a set of react components and i am trying to use them in an Angular 2 app. Here is the Main React Component that i am trying to use import React, {Component} from 'react'; import { createStore, applyMiddleware } from 'redux'; import {…
Sateesh K
  • 1,071
  • 3
  • 19
  • 45
10
votes
3 answers

Angular 10 Cannot read property 'bindingStartIndex' of null when using Library while rendering component from different workspace

I created an Angular-Library which is outside of my App-Workspace. The result is that I have two different workspaces. My first approach was building my Library and link /dist folder with my App. This worked not so fine with ng serve but anyways I…
10
votes
0 answers

Can't build Angular library with SASS mixin from node modules

Setup: Angular 9 workspace with libraries, a test app and storybook using CDK's _overlay.scss in a .scss file with @use. .storybook/ node_modules/ projects/ - library/ - src/ - lib/ - component/ component.scss // `@use`s…
pfeileon
  • 290
  • 1
  • 17
10
votes
2 answers

`npm install` from sub directory of a Git repository

Greeting, I have created an angular library and I have built & pushed it into private repo in gitlab, now I need to consume it inside another project so I have tried to import it using the following line in package.json "my-core-lib":…
Jovani
  • 101
  • 1
  • 4
10
votes
2 answers

Angular Library Route Module does not work when imported in application

I need a help about an issue that I cannot solve. I'm studying angular 7 library in order to add modularization to my application but module routes defined in library seems not work when install it in a application. I have created project to github…
rvt
  • 217
  • 1
  • 2
  • 10
10
votes
2 answers

Angular Library Module generate a component from workspace

I have an Angular Workspace created with three projects. As well as I have just created a Library that I would like to have reusable modules inside. Typically for the projects (applications and library) I run the following to generate a module or…
1
2
3
41 42