Git Product home page Git Product logo

Comments (8)

yobryon avatar yobryon commented on August 12, 2024

looks like there was a problem packing 0.2.0... I've re-published this properly and bumped to v0.2.1. Try again -- it should work fine with angular2 -- but if you still have trouble with it after bumping to 0.2.1, i'll take a deeper look.

from ngx-barcode.

mckinleymedia avatar mckinleymedia commented on August 12, 2024

Thanks! The module is now found, but I now get this error:
"export 'Renderer2' was not found in '@angular/core'
I know that's one of the changes between Angular 2 and 4. Do you have a fix for that?

from ngx-barcode.

nadircan avatar nadircan commented on August 12, 2024

Thanks! The module is now found, but I now get this error:
"export 'Renderer2' was not found in ''
I know that's one of the changes between Angular 2 and 4. Do you have a fix for that?

I get the same error. What is the solution?

from ngx-barcode.

mckinleymedia avatar mckinleymedia commented on August 12, 2024

I couldn't get the module to work, so I just ended up importing the jsbarcode library directly like this:
npm install jsbarcode -S
then in the component html:
<canvas class="jsbarcode"></canvas>
then in component js I added these 4 things:
let jsbarcode = require('jsbarcode');
and
bcInit = false;
and
ngAfterViewChecked() { this.createBarcode(); }
and
createBarcode() { if (!this.bcInit) { let element = document.getElementsByClassName("jsbarcode")[0]; if (element) { jsbarcode(element, this.data.id, { format: 'CODE128' }); this.bcInit = true; } } }
Not really the best way to do it, using getElementsByClassName, but it works. Hope this helps.

from ngx-barcode.

mark-win avatar mark-win commented on August 12, 2024

Could not reproduce using Angular 4.2.2 and ngx-barcode 0.2.1. Everything worked out of the box as described in readme.md.

from ngx-barcode.

mckinleymedia avatar mckinleymedia commented on August 12, 2024

@mark-win - Per the title of this thread, my question was specifically for Angular 2, not Angular 4.

from ngx-barcode.

yobryon avatar yobryon commented on August 12, 2024

In a desire to keep this compatible with server-side rendering, and to keep close to the direction of the angular renderer, this project will keep its use of Renderer2 and require angular 4 minimum. Renderer is deprecated in favor of Renderer2, where the former will probably be removed at some point in the not-too-distant future. The angular team has kept things fairly minimal in terms of overall effort to accommodate their API changes over time, so hopefully projects can migrate up to angular 4/5+.

from ngx-barcode.

ramanbalaji avatar ramanbalaji commented on August 12, 2024

I'm looking for an ionic angular js MSI barcode scanner. Can the ngx-barcode be used for scanning MSI barcodes or only for creating MSI barcodes? Any help is greatly appreciated.

from ngx-barcode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.