kamalav
kamalav

Reputation: 1200

How to use Hammer in angular universal

Can anyone pls help me to fix hammer error

})(window, document, 'Hammer');
^
 ReferenceError: window is not defined
at Object._MAP.8 (/Users/ks89/git/universal-starter/dist/server.js:126460:4)

in angular universal.

Upvotes: 4

Views: 3176

Answers (1)

David
David

Reputation: 34445

You need to import hammer from main.ts, not directly from the module. That way, it won't be included server side

https://github.com/angular/material2/blob/master/guides/getting-started.md#step-5-gesture-support

Upvotes: 6

Related Questions