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
10
votes
4 answers

Custom Angular library with ngx-translate

I've created my own private angular library with multiple components to make my life easier. I made this library by following this tutorial. Everything worked out great I even added it to another project to test it out. Now comes the part where I…
Beejee
  • 1,836
  • 2
  • 17
  • 31
9
votes
3 answers

Angular 13 package/library throws error "moment is not a function" when imported into a Angular 13 project

Im upgrading a private angular library/package (my-lib) so i can migrate all other projects, but when imported into a project one of the services uses moment and throws an error: "ERROR TypeError: moment is not a function" The library works in dev…
9
votes
1 answer

Angular 9 library with subentry points circular dependency

I have a very specific question about angular libraries secondary entry points setup. I really don't understand how i can setup it to get it work when they depend on each other including the main entry point. I've read the docs for the ng-packagr…
JohnnyDevNull
  • 951
  • 1
  • 8
  • 20
9
votes
2 answers

How to export models from libraries in Angular?

I created an Angular library, but I want to export a Model which my application can use. How can I do that ? For example : my-library library-model.ts export class LibraryModel{ //some model data } my-library.component.ts import { Component,…
psithyros
  • 91
  • 1
  • 1
  • 3
9
votes
1 answer

Is it safe to set the tsconfig target to es6 if you don't care about old browsers?

In an Angular application, is it safe to set the tsconfig.json compilerOptions.target to "es6" (or the equivalent "es2015") if you don't care about old browsers? About this matter, in the official Angular documentation is written: By default, the…
Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252
9
votes
2 answers

Angular Module vs. Library

So great, the Angular has released version 6 and the CLI provides an option to generate libraries - something that they call a "highly anticipated feature". Now, coming from a business perspective, I am wondering: why you would actually need this,…
hogan
  • 1,434
  • 1
  • 15
  • 32
8
votes
3 answers

What is the best way to publish Angular Library styled with TailwindCSS?

The goal is to create component modules as Angular Library and keep it separate from the main application. So, components library maintained as standalone package published to NPM, and then can be imported into different applications. Component…
Max Coffer
  • 81
  • 2
8
votes
0 answers

Nx worskpace: import style file from library to app

I am working with Angular 12. I created one library and one project. In my library I have style (dark-theme.scss) file which I want to provide to the app. I know from documentation that I need to set assets to ng-packagr. In nx workspace that is…
Milos
  • 1,678
  • 4
  • 23
  • 49
8
votes
1 answer

Angular 10.x library development with npm link doesn't show html/css changes in browser on hot reload

I've created an Angular lib (mylib) using the cli and have created a symlink using npm link from the dist directory. I've created an Angular app using the cli and have linked the lib using npm link mylib. I am able to consume mylib from the app and…
Mike
  • 665
  • 6
  • 14
8
votes
1 answer

ERROR in Cannot resolve type entity i9.NgxFileDropModule to symbol

I have migrated angular 8 to version 10. Application is using custom angular library which is also being migrated from version 7 to 10. this library has NgxFileDropModule which is imported as (import { NgxFileDropModule } from 'ngx-file-drop';) but…
Parul
  • 81
  • 1
  • 2
8
votes
2 answers

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.
Jayampathy Wijesena
  • 1,670
  • 1
  • 18
  • 26
8
votes
1 answer

Angular Elements vs Angular Library?

My team works with multiple angular projects. For code reuse, we have a lot of presentational components extracted into libraries, which we then use in our various projects. So, given that all our projects are on angular, and we already use…
Somjit
  • 2,503
  • 5
  • 33
  • 60
8
votes
2 answers

Angular library bundle dependencies

I've created and bundled an Angular (7.2.0) Library using the CLI: ng g library MyLibrary ng build MyLibrary This gives me the my-libary.umd.js bundle that I need. Currently, all dependencies are added as peerDependencies in the library…
Thomas Schneiter
  • 1,103
  • 2
  • 19
  • 35
8
votes
1 answer

Can I have angular library that emits Angular elements in single js file?

I'm starting to get into the angular 6 bits, and am very interested in Angular Elements as well as the new library projects. I have an upcoming project that will probably need both these new features. I have the need to create custom UI components…
cobolstinks
  • 6,801
  • 16
  • 68
  • 97
8
votes
4 answers

Angular html file not found in component library

I'm building a component library for angular which we will share across projects. But when i build the package the html files don't get copied to the dist folder. I get the error angular Failed to load text-input.component.html. This is my…
Sjoerd de Wit
  • 2,353
  • 5
  • 26
  • 45
1 2
3
41 42