ngCropper icon indicating copy to clipboard operation
ngCropper copied to clipboard

Error when not specifying 'build' option

Open cphyc opened this issue 9 years ago • 1 comments

When not declaring 'build' option, cropper is unable to attach the build event and therefore returns a window object, that cannot be triggered:

The line that fails is this one:

$this.one(EVENT_BUILD, options.build).trigger(buildEvent);)

it throws the error:

TypeError: $this.one(...).trigger is not a function
    at Cropper.prototype.load (ngCropper.all.js:formatted:258)
    at new Cropper (ngCropper.all.js:formatted:230)
    at HTMLImageElement.<anonymous> (ngCropper.all.js:formatted:2201)
    at Function.jQuery.extend.each (jquery.js:360)
    at jQuery.fn.jQuery.each (jquery.js:137)
    at $.fn.cropper (ngCropper.all.js:formatted:2195)
    at ngCropper.all.js:formatted:2249
    at processQueue (angular.js:14745)
    at angular.js:14761
    at Scope.$eval (angular.js:15989)

You should replace the options.build by options.build || function() {}.

cphyc avatar Feb 16 '16 10:02 cphyc

There is also the error with a missing options.built function.

cphyc avatar Feb 16 '16 10:02 cphyc