-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Note: for support questions, please use one of these channels:
https://github.com/angular/material2/blob/master/CONTRIBUTING.md#question.
This repository's issues are reserved for feature requests and bug reports.
- Do you want to request a feature or report a bug?
Bug
- What is the current behavior?
If I use prerender libraries for angular universal to precompile a component that uses MdButton
, it fails as soon as the compiled button.js module is loaded because of the presence of a global Event
object that doesn't exist in node.
This line is the offender: https://github.com/angular/material2/blob/d4a3cde52ba736da64285bdfaf039129d0dd8312/src/components/button/button.ts#L122
Because of the HostListener
decorator, the type information for that method gets preserved as follows:
__decorate([
core_1.HostListener('click', ['$event']),
__metadata('design:type', Function),
__metadata('design:paramtypes', [Event]), // <-- there's the problem
__metadata('design:returntype', void 0)
], MdAnchor.prototype, "haltDisabledEvents", null);
- Which version of Angular and Material, and which browser and OS does this issue affect?
Did this work in previous versions of Angular / Material?
Please also test with the latest stable and snapshot versions.
Beta.1 and Beta.2.
- Other information
(e.g. detailed explanation, stacktraces, related issues, suggestions how to fix)
ReferenceError: Could not require 'angular-cli-build.js': Event is not defined
at project/node_modules/@angular2-material/button/button.ts:121:37
at Object.<anonymous> (project/node_modules/@angular2-material/button/button.ts:94:1)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (project/src/client/app/issue-cli.ts:7:1)
at Module._compile (module.js:413:34)