question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Class constructor HammerGestureConfig cannot be invoked without 'new'

See original GitHub issue

Hi, i work with Angular 7.2.5

I get this traceback in browser at module load :

app.browser.module.ts:14 TypeError: Class constructor HammerGestureConfig cannot be invoked without 'new'
    at new CustomHammerConfig (ngx-gallery.umd.js:1664)
    at _createClass (core.js:26964)
    at _createProviderInstance (core.js:26931)
    at resolveNgModuleDep (core.js:26878)
    at _callFactory (core.js:27002)
    at _createProviderInstance (core.js:26934)
    at resolveNgModuleDep (core.js:26878)
    at _createClass (core.js:26968)
    at _createProviderInstance (core.js:26931)
    at resolveNgModuleDep (core.js:26878)
push../angular/app/app.browser.module.ts.CumaErrorHandler.handleError @ app.browser.module.ts:14
(anonymous) @ core.js:22532
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:391
push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:150
runOutsideAngular @ core.js:21773
(anonymous) @ core.js:22532
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:391
onInvoke @ core.js:21825
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:390
push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:150
(anonymous) @ zone.js:889
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:423
onInvokeTask @ core.js:21816
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:422
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:195
drainMicroTaskQueue @ zone.js:601
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:502
invokeTask @ zone.js:1744
globalZoneAwareCallback @ zone.js:1781
load (async)
customScheduleGlobal @ zone.js:1883
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:410
onScheduleTask @ zone.js:301
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:404
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:238
push../node_modules/zone.js/dist/zone.js.Zone.scheduleEventTask @ zone.js:264
(anonymous) @ zone.js:2054
(anonymous) @ http.js:1868
_trySubscribe @ Observable.js:42
subscribe @ Observable.js:28
call @ tap.js:16
subscribe @ Observable.js:23
call @ catchError.js:16
subscribe @ Observable.js:23
(anonymous) @ subscribeTo.js:20
subscribeToResult @ subscribeToResult.js:7
_innerSub @ mergeMap.js:59
_tryNext @ mergeMap.js:53
_next @ mergeMap.js:36
next @ Subscriber.js:49
(anonymous) @ scalar.js:4
_trySubscribe @ Observable.js:42
subscribe @ Observable.js:28
call @ mergeMap.js:21
subscribe @ Observable.js:23
call @ filter.js:13
subscribe @ Observable.js:23
call @ timeoutWith.js:20
subscribe @ Observable.js:23
call @ retryWhen.js:13
subscribe @ Observable.js:23
call @ map.js:16
subscribe @ Observable.js:23
call @ catchError.js:16
subscribe @ Observable.js:23
call @ map.js:16
subscribe @ Observable.js:23
push../angular/app/services/configuration.service.ts.ConfigurationService.initialize @ configuration.service.ts:18
(anonymous) @ configuration.service.ts:36
ZoneAwarePromise @ zone.js:910
(anonymous) @ configuration.service.ts:35
runInitializers @ core.js:21164
(anonymous) @ core.js:22414
_callAndReportToErrorHandler @ core.js:22529
(anonymous) @ core.js:22411
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:391
onInvoke @ core.js:21825
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:390
push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:150
run @ core.js:21712
bootstrapModuleFactory @ core.js:22399
(anonymous) @ core.js:22446
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:391
push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:150
(anonymous) @ zone.js:889
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:423
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:195
drainMicroTaskQueue @ zone.js:601
Promise.then (async)
scheduleMicroTask @ zone.js:584
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:413
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:238
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask @ zone.js:258
scheduleResolveOrReject @ zone.js:879
ZoneAwarePromise.then @ zone.js:1012
bootstrapModule @ core.js:22446
bootstrap @ main.browser.ts:43
./angular/main.browser.ts @ main.browser.ts:39
__webpack_require__ @ bootstrap:83
0 @ main.js:4160
__webpack_require__ @ bootstrap:83
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.js:1
Show 47 more frames
zone.js:682 Unhandled Promise rejection: Class constructor HammerGestureConfig cannot be invoked without 'new' ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Class constructor HammerGestureConfig cannot be invoked without 'new'
    at new CustomHammerConfig (ngx-gallery.umd.js:1664)
    at _createClass (core.js:26964)
    at _createProviderInstance (core.js:26931)
    at resolveNgModuleDep (core.js:26878)
    at _callFactory (core.js:27002)
    at _createProviderInstance (core.js:26934)
    at resolveNgModuleDep (core.js:26878)
    at _createClass (core.js:26968)
    at _createProviderInstance (core.js:26931)
    at resolveNgModuleDep (core.js:26878) TypeError: Class constructor HammerGestureConfig cannot be invoked without 'new'
    at new CustomHammerConfig (http://localhost:4200/vendor.js:151714:47)
    at _createClass (http://localhost:4200/vendor.js:70369:20)
    at _createProviderInstance (http://localhost:4200/vendor.js:70336:26)
    at resolveNgModuleDep (http://localhost:4200/vendor.js:70283:21)
    at _callFactory (http://localhost:4200/vendor.js:70407:32)
    at _createProviderInstance (http://localhost:4200/vendor.js:70339:26)
    at resolveNgModuleDep (http://localhost:4200/vendor.js:70283:21)
    at _createClass (http://localhost:4200/vendor.js:70373:29)
    at _createProviderInstance (http://localhost:4200/vendor.js:70336:26)
    at resolveNgModuleDep (http://localhost:4200/vendor.js:70283:21)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:32

github_iconTop GitHub Comments

61reactions
theoryecommented, Aug 4, 2019

Modify the providers in your app.module.ts with

export class CustomHammerConfig extends HammerGestureConfig  {
   overrides = {
       pinch: { enable: false },
       rotate: { enable: false }
   };
}

and add to the Providers

providers: [
{ provide: HAMMER_GESTURE_CONFIG, useClass: CustomHammerConfig }
]
45reactions
Oussailcommented, Jun 18, 2019

@PawelSpoon A temporary fix that works 💯 for now : in the file ngx-gallery.umd.js changes this lines of code :

var CustomHammerConfig = /** @class */ (function (_super) { __extends(CustomHammerConfig, _super); function CustomHammerConfig() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.overrides = ({ ‘pinch’: { enable: false }, ‘rotate’: { enable: false } }); return _this; } return CustomHammerConfig; }(platformBrowser.HammerGestureConfig));

to :

class CustomHammerConfig extends platformBrowser.HammerGestureConfig { constructor() { super(…arguments); this.overrides = ({ ‘pinch’: { enable: false }, ‘rotate’: { enable: false } }); } }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class constructor HammerGestureConfig cannot be invoked ...
When inspect an error appears ERROR Type Error: The class constructor HammerGestureConfig cannot be invoked without 'new'.
Read more >
Angular – How to fix ERROR TypeError: Class constructor ...
ERROR Type Error : The class constructor HammerGestureConfig cannot be invoked without 'new'. I have added hammerjs in app.module but there is still...
Read more >
[Solved]-How to fix ERROR TypeError: Class constructor ...
Coding example for the question How to fix ERROR TypeError: Class constructor HammerGestureConfig cannot be invoked without 'new'-angular.js.
Read more >
typeerror: class constructor cannot be invoked without 'new'
Update: the original problem, message saying **TypeError: Class constructor Lexer cannot be invoked without 'new' ** is caused by a mismatch between the ......
Read more >
How to fix ngx-gallery: Class constructor ... - CodeInterpreter
Class constructor HammerGestureConfig cannot be invoked without 'new '. My first though there's something happen in Angular or ngx-bootsrap ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found