问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/49335441/how-to-use-hammer-in-angular-universal