首页 > angular2运行报错: error TS2304: Cannot find name '$'.

angular2运行报错: error TS2304: Cannot find name '$'.

如题,我要该怎么改文件,在哪改?
这是报错:

这里是tsconfig文件:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]
}

主要原因就是我在这两个文件用了bootstrap的模态框,用了$().modal('hide');
然后模态框是可以用的,但是报错的意思好像是找不到$符号??


已解决:在browser.d.t文件中写入declare var $:any;

【热门文章】
【热门文章】