Getting Started

This section explains briefly about how to integrate a Barcode control in your application with Angular.

Script and CSS Reference

Create a HTML page and add the scripts and CSS references in the order mentioned in the following code example.

  • html
  • <!DOCTYPE html>
        <html>
        <head> 
            <link href="//cdn.syncfusion.com/14.3.0.49/js/web/flat-azure/ej.web.all.min.css" rel="stylesheet" />
            <script src="node_modules/core-js/client/shim.min.js"></script>
            <script src="node_modules/zone.js/dist/zone.js"></script>
            <script src="node_modules/reflect-metadata/Reflect.js"></script>
            <script src="node_modules/systemjs/dist/system.src.js"></script>
            <script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
            <script src="http://cdn.syncfusion.com/js/assets/external/jsrender.min.js" type="text/javascript"></script>
            <script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"></script>
            <script src="http://cdn.syncfusion.com/14.3.0.49/js/web/ej.web.all.min.js" type="text/javascript"></script>
            <script src ="http://cdn.syncfusion.com/14.3.0.49/js/common/ej.angular2.min.js"></script>
            <script src="systemjs.config.js"></script>
        </head>
        <body>
        <ej-app>Loading...</ej-app>
        </body>
        </html>

    In the above code, ej.web.all.min.jsscript reference has been added for demonstration purpose. It is not recommended to use it during deployment, as it contains all the widgets, which results in deploying large script file. Instead, you can use[CSG](http://csg.syncfusion.com/# “”) utility to generate a custom script file with the required widgets for deployment purpose.

    Initialize and configure the control

    The code example for defining Barcode control in Angular is as follows,

  • html
  • <ej-barcode text="http://www.syncfusion.com" id="barcode1" xDimension="8">
        </ej-barcode>
  • ts
  • import { Component } from '@angular/core';
    
    @Component({
      selector: 'ej-app',
      templateUrl: 'app/components/barcode/default.component.html'
    })
    export class DefaultComponent {
      constructor(public northwindService: NorthwindService) { }
    }

    The above code will produce the Barcode as shown in the below figure.