angular2-library | How to create a library in Angular2 | Build Tool library

 by   daniele-zurico JavaScript Version: Current License: MIT

kandi X-RAY | angular2-library Summary

kandi X-RAY | angular2-library Summary

angular2-library is a JavaScript library typically used in Utilities, Build Tool, Angular, NPM applications. angular2-library has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

this project show how to package a library using ngc. For more information please visit: ###how to install npm install. ###how to package the library npm run build. ###how to use the package in your project npm install ../angular2-library (specify the correct path).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              angular2-library has a low active ecosystem.
              It has 16 star(s) with 4 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 2 open issues and 2 have been closed. On average issues are closed in 6 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of angular2-library is current.

            kandi-Quality Quality

              angular2-library has 0 bugs and 0 code smells.

            kandi-Security Security

              angular2-library has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              angular2-library code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              angular2-library is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              angular2-library releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.
              angular2-library saves you 1 person hours of effort in developing the same functionality from scratch.
              It has 6 lines of code, 0 functions and 16 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of angular2-library
            Get all kandi verified functions for this library.

            angular2-library Key Features

            No Key Features are available at this moment for angular2-library.

            angular2-library Examples and Code Snippets

            No Code Snippets are available at this moment for angular2-library.

            Community Discussions

            QUESTION

            Custom Angular Library Import multiple Modules not barrel
            Asked 2019-Jan-18 at 20:18

            Hi I am trying to build a custom Angular Library. Using yeoman-generator (link) I get a template to build upon, that works just fine. The problem is that it uses a (not anymore best practice) barrel index.ts, and what I want is to be able to have one module per component and import accordingly.

            ...

            ANSWER

            Answered 2017-Sep-07 at 05:28

            In case someone faces the same problem, here is how my files are now structured and connected:

            I have a component with the desired functionality HelloWorld

            Then a module for this component:

            Source https://stackoverflow.com/questions/46075235

            QUESTION

            Errors when using MomentJS in Angular Typescript library
            Asked 2019-Jan-05 at 12:20

            I'm building an Angular (2+) component library using jvandemo/generator-angular2-library as a starter, which uses Rollup as a module builder. The component I am creating in the library uses MomentJS.

            I've had various build issues with the inclusion of MomentJS.

            I first used import moment from 'moment'; to import moment into the component, but that produces the following error at build;

            ...

            ANSWER

            Answered 2017-Oct-25 at 21:59

            In the sample directive I had no problem compiling when I used the following:

            Source https://stackoverflow.com/questions/46876541

            QUESTION

            --prod Build giving warnings and deployed app not loading after upgrading to Angular 7
            Asked 2018-Oct-30 at 06:40

            I recently upgraded an existing Angular 6 App to Angular 7. Most of my App was built on Angular 6 and then I upgraded it.

            Here's my package.json:

            ...

            ANSWER

            Answered 2018-Oct-30 at 06:40

            I had the same WARNINGS and ERROR after upgrade from Angular 6 to Angular 7. I have deleted my node_modules folder then npm install again. Now the compilation succeeds without warnings and I have no more the error "Uncaught TypeError: e is not a constructor".

            Source https://stackoverflow.com/questions/52975243

            QUESTION

            Angular Library is not running ngOnInit when used
            Asked 2018-Jun-08 at 03:26

            I'm following the Angular CLI 6 instructions for creating a library here. I was able to make my library, and build it successfully. The library consists of a Component I am using for the UI and has an HTML selector.

            ...

            ANSWER

            Answered 2018-Jun-08 at 03:26

            Only issue i see is that your instance of the service also has the same name, change it as

            Source https://stackoverflow.com/questions/50752687

            QUESTION

            Angular 4 Library @Input
            Asked 2018-Mar-07 at 09:10

            Hi guys I need a bit of help, as I can't seem to get it to work. I think I might be using the incorrect syntax or something.

            I am currently building Angular 4 libraries using YO https://github.com/jvandemo/generator-angular2-library

            So everything is working except for the @Input decorators.

            Some simple code here

            ...

            ANSWER

            Answered 2018-Mar-07 at 09:10

            QUESTION

            Angular 2 external lib error
            Asked 2017-Nov-16 at 20:51

            I generate my angular 2 lib with yeoman generator and added to main angular project. If i compile app in dev mode i haven't error, but if i run prod mode, i get many errors:

            ...

            ANSWER

            Answered 2017-Nov-16 at 20:51

            Your intent was probably to export just what is needed, but you need to export everything from your src/index.ts file, including all the services, directives, and pipes.

            Source https://stackoverflow.com/questions/45615528

            QUESTION

            Setting up Karma for an angular library
            Asked 2017-Oct-18 at 19:13

            I am currently building an Angular library, and I wanted to be able to run some tests. After following these instructions I managed to set up everything properly and actually be able to run my tests.

            Main question

            Although everything runs properly something awkward happens. When I run npm test next to every .ts file a .js file is generated. Normally all the d.ts and the one big .js files go inside a dist folder that projects using the library use. So does anyone know from where could these javascript files are generated, and if they are indeed needed, since all this code already exists so to speak in the dist folder.

            Bonus question

            Not as important as the above, all the test results are displayed in the terminal, whereas the browser displays only:

            Karma v1.4.1 - connected Chrome 61.0.3163 (Mac OS X 10.12.6) is idle

            So is there a nice fix to display my test as nicely as the angular-cli does out of the box?

            Note that after doing my homework I did not find something relative online, and I don't want to upload a bunch of unpleasant jsons. If anyone has an idea on the direction of the problem I will be happy to include code.

            The basic structure of my library was generated by this

            Edit: karma.config.js

            ...

            ANSWER

            Answered 2017-Oct-18 at 16:06

            You are getting .js file for every .ts file because of your typescript configuration. You can change your configuration in tsconfig.json to tell compiler that write a single file or in a folder and add all script there.

            "outDir": "../out-tsc/spec" --> will add all output javascript files in a single folder.

            For your second question, When karma runs internally it runs webdriver and connect to the browser. That is the reason you see localhost:9876 or similar url open with a debug button at the right.

            While the webdriver is running you can also debug any bug situation in the browser and lot more.

            Source https://stackoverflow.com/questions/46813971

            QUESTION

            Create Angular 2 component library without inline styles
            Asked 2017-Sep-22 at 03:57

            I red this article about creating Angular 2 component library, and it uses inline styles. Is there a way to create a lib without inline styles in Angular 2?

            Also I saw this, but there is no word about styles, css.

            My problem is, I want to create a complex component with multiple components in it and I use SASS also.

            ...

            ANSWER

            Answered 2017-Sep-22 at 03:57

            The problem here is that when you compile your npm package the styles templates must be inline because when you load it as a npm package you won't be able to achieve the template/css path inside node_modules.

            The Angular Material 2 team used the follow gulp task to inline the css and template in its components:

            They have created this task file that

            1. Get external CSS and put inline;
            2. Get external Html and put inline;
            3. Removes the module.id from components;

            Finally, in the build process they call this task here.

            My approach of doing this:
            1. Install gulp, gulp-angular-embed-templates, gulp-inline-ng2-styles.

            2. Create a file called gulpfile.js at the root of your app

            3. add the following code to your gulpfile:

            Source https://stackoverflow.com/questions/41550388

            QUESTION

            Can't Resolve NPM Dependencies in Shared Angular 2 Library
            Asked 2017-Jul-27 at 16:03

            I am trying to create an Angular 2 library for services, components, and models I want to share between 3-4 different interfaces/apps that are frontends to the same database.

            I am using the very helpful Angular 2 generator library here.

            My services in the library are based around Apollo client and GraphQL.

            However, when I symlink the library build to import into my main project, the Apollo dependencies don't seem to resolve.

            I get the following two errors from my app build: Can't resolve 'apollo-angular/index' and Can't resolve 'graphql-tag/index'. This is in spite of the fact that both these libraries are installed to my node_modules in my app, however, they don't seem to transferred by the Gulp build into my dist directory of my library but I am not even sure they are meant to be.

            I have also tried to setup peer dependencies in my library's package.json as follows:

            ...

            ANSWER

            Answered 2017-Jul-27 at 16:03

            It might occur because of this issue.

            Try to define paths in your ts

            Source https://stackoverflow.com/questions/45319138

            QUESTION

            Cant get Angular component to work in project, using webpack?
            Asked 2017-Jul-18 at 11:56

            I have created an angular componet (datetime-popup) found here

            I want to be able to use it in my projects, but i cannot get it to work. I believe i need to make it a umd library or something with webpack, but i have had a look on this internet and i cannot find how to do this, as whatever i do, it errors.

            Can someone help me to sort this out? I would like to be able to reference the project in the demo, and also use it via an external project using npm.

            EDIT:

            I have tried to duplicate this project but for some reason, when i build my example project, it get an exception in a script

            bundle.js:39725 Uncaught SyntaxError: Unexpected token export

            Here is the exception. This isnt my code and works fine when the ngx-bootstrap project is in the project

            ...

            ANSWER

            Answered 2017-Jul-18 at 11:56

            Packaging Angular libraries is still a bit of a black art. It is on the angular-cli roadmap to provide better out-of-the-box support. Meanwhile, you can consult this excellent overview.

            Basically, you need to compile your modules and components with ngc, based on a tsconfig.json with specific settings, this being a necessary step in order to create the metadata required by Angular builds, and in-line the templates and CSS (pre-processed if necessary) if they are in external files. The consuming application then imports the modules and components from the directory into which they have been compiled, often something like dist or lib, which can be accomplished with an entry in package.json such as "module": "dist/index.js". If you are publishing to npm, then you could simply publish the dist directory. It is beyond the scope of this short answer to provide more exhaustive details.

            Source https://stackoverflow.com/questions/45148333

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install angular2-library

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/daniele-zurico/angular2-library.git

          • CLI

            gh repo clone daniele-zurico/angular2-library

          • sshUrl

            git@github.com:daniele-zurico/angular2-library.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link