angular-moment-picker: Picker broken by minification

I’m using Gulp to create a build of my Angular app, unluckily seems that your directive is broken by the minification. This error is logged in each page containing the moment-picker directive.

TypeError: Cannot read property 'isAfterOrEqualMin' of undefined
    at Object.isSelectable (http://localhost:3000/scripts/vendor-7cd641134b.js:283:3615)
    at http://localhost:3000/scripts/vendor-7cd641134b.js:283:20461
    at Array.forEach (native)
    at e.render (http://localhost:3000/scripts/vendor-7cd641134b.js:283:20391)
    at render (http://localhost:3000/scripts/vendor-7cd641134b.js:283:7731)
    at r (http://localhost:3000/scripts/vendor-7cd641134b.js:8:10294)
    at y.$eval (http://localhost:3000/scripts/vendor-7cd641134b.js:8:13163)
    at y.$digest (http://localhost:3000/scripts/vendor-7cd641134b.js:8:11636)
    at t.$apply (http://localhost:3000/scripts/vendor-7cd641134b.js:8:13446)
    at HTMLTableCellElement.<anonymous> (http://localhost:3000/scripts/vendor-7cd641134b.js:10:20511)

The picker shows an empty calendar: schermata 2016-12-29 alle 19 06 25

When clicking on the arrows the same error as before is thrown.

The build task is configured as follows:

gulp.task('build', build);

function build() {
  const partialsInjectFile = gulp.src(conf.path.tmp('templateCacheHtml.js'), {read: false});
  const partialsInjectOptions = {
    starttag: '<!-- inject:partials -->',
    ignorePath: conf.paths.tmp,
    addRootSlash: false
  };

  const htmlFilter = filter(conf.path.tmp('*.html'), {restore: true});
  const jsFilter = filter(conf.path.tmp('**/*.js'), {restore: true});
  const cssFilter = filter(conf.path.tmp('**/*.css'), {restore: true});

  return gulp.src(conf.path.tmp('/index.html'))
    .pipe(inject(partialsInjectFile, partialsInjectOptions))
    .pipe(useref())
    .pipe(jsFilter)
    .pipe(ngAnnotate())
    .pipe(uglify({preserveComments: uglifySaveLicense})).on('error', conf.errorHandler('Uglify'))
    .pipe(rev())
    .pipe(jsFilter.restore)
    .pipe(cssFilter)
    .pipe(cssnano())
    .pipe(rev())
    .pipe(cssFilter.restore)
    .pipe(revReplace())
    .pipe(htmlFilter)
    .pipe(htmlmin())
    .pipe(htmlFilter.restore)
    .pipe(gulp.dest(conf.path.dist()));
}

Any idea on how to solve?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 28 (8 by maintainers)

Most upvoted comments

Hi @selectedpixel, have you tried @domalak solution? It works fine for me.

Here is how I do it, in bower.json I added this :

"overrides": { "angular-moment-picker" : { "main": [ "dist/angular-moment-picker.js", "dist/angular-moment-picker.css" ] } }

I had this problem too. I solved it by telling Gulp to use angular-moment-picker.js instead of angular-moment-picker.min.js which was taken by default.

Hi,

First of all I would like to thank you indrimuska for your great job, this module is amazing! Unfortunately I am facing exactly the same issue, is there any update concerning this issue?

Besides, following message of @destegabry of 9th january I have tried older versions, it indeed works fine with the version 0.8.4, but the version that comes directly next has the problem, it is the version 0.9.0. It seems that the regression has been introduced with this version, the version 0.9.0.

Thanx