How to generate barcode with ionic+cordova?

I have one problem. I use phonegap-plugin-barcodescanner. Scan work perfect but generator barcode doesn’t work? When I press button to encoding my app crashing and have error “unfortunately app has stopped”. Please help me)

i’ve used

in some apps to generate a qr-code with pure javascript.

I have used Angular-Barcode

Works great.

I made a basic directive with JsBarcode

  .directive('barcode', function () {
      "use strict";
      return {
          restrict: 'EA',
          scope: {
              data: '='
          },
          template: '<canvas id=barcode></canvas>',
          link: function ($scope, element) {
              var canvas = element.find('canvas');
              new JsBarcode(canvas[0], $scope.data);
          }
      };
  })

Then, how to use it ?
How to add barcode value into the barcode directive ?

Does any develeper here may integrate this option into existing ionic app?