Recently, I attempted to incorporate ng2-select into a project that relies on angular/universal-starter (TypeScript 2.x) as its foundation.
(Interestingly, ng2-select worked perfectly fine when added to an angular-cli generated project.)
However, upon adding the following two lines:
import { SELECT_DIRECTIVES } from 'ng2-select/ng2-select';
@Component({
directives: [SELECT_DIRECTIVES],
...
I encountered an error in my terminal right away:
ReferenceError: MouseEvent is not defined at /my-project/node_modules/ng2-select/components/select/off-click.js:33:42 at Object.<anonymous> (/my-project/node_modules/ng2-select/components/select/off-click.js:43:2) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) // more similar errors follow [nodemon] app crashed - waiting for file changes before starting...
Here is a snippet of my tsconfig.json configuration:
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"module": "commonjs",
"removeComments": true,
"sourceMap": true,
"lib": ["es6", "dom"]
},
"include": [
"node_modules/@types/**/*.d.ts",
"src/**/*.ts"
],
"exclude": [
"node_modules",
"!node_modules/@types/**/*.d.ts"
],
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}