在我的角度4.2.4项目中无法使用“angular2-serverpagination-datatable”

时间:2018-05-15 10:21:08

标签: javascript angular typescript

我正在尝试在我的angular 4应用程序中集成以下"angular2-serverpagination-datatable"数据表模块用于服务器端分页,但在运行ng服务后总是会出现以下错误:

  

“ERROR in Error遇到静态解析符号值。   调用函数'makeDecorator',不支持函数调用。   考虑使用对a的引用替换函数或lambda   导出函数,解析符号NgModule in   /home/bhuvnesh-kumar/Bhuvnesh/Sourcefuse/Proj_ICLP/angular4/scotchy-scotch/node_modules/angular2-serverpagination-datatable/node_modules/@angular/core/src/metadata/ng_module.d.ts,   解决符号NgModule in   /home/bhuvnesh-kumar/Bhuvnesh/Sourcefuse/Proj_ICLP/angular4/scotchy-scotch/node_modules/angular2-serverpagination-datatable/node_modules/@angular/core/src/metadata.d.ts,   解决符号NgModule in   /home/bhuvnesh-kumar/Bhuvnesh/Sourcefuse/Proj_ICLP/angular4/scotchy-scotch/node_modules/angular2-serverpagination-datatable/node_modules/@angular/core/src/core.d.ts,   解决符号NgModule in   /home/bhuvnesh-kumar/Bhuvnesh/Sourcefuse/Proj_ICLP/angular4/scotchy-scotch/node_modules/angular2-serverpagination-datatable/node_modules/@angular/core/index.d.ts,   解析符号DataTableModule   /home/bhuvnesh-kumar/Bhuvnesh/Sourcefuse/Proj_ICLP/angular4/scotchy-scotch/node_modules/angular2-serverpagination-datatable/lib/DataTableModule.d.ts,解析符号DataTableModule in   /home/bhuvnesh-kumar/Bhuvnesh/Sourcefuse/Proj_ICLP/angular4/scotchy-scotch/node_modules/angular2-serverpagination-datatable/lib/DataTableModule.d.ts“

注意:关注程序包"angular2-datatable",它只提供完全在同一应用程序中运行的客户端分页

的package.json

 "dependencies": {
    "@angular/animations": "^4.2.4",
    "@angular/common": "^4.2.4",
    "@angular/compiler": "^4.2.4",
    "@angular/core": "^4.2.4",
    "@angular/forms": "^4.2.4",
    "@angular/http": "^4.2.4",
    "@angular/platform-browser": "^4.2.4",
    "@angular/platform-browser-dynamic": "^4.2.4",
    "@angular/router": "^4.2.4",
    "angular2-datatable": "^0.6.0",
    "angular2-datatable-serverpagination": "^0.6.3",
    "angular2-serverpagination-datatable": "^1.5.4",
    "core-js": "^2.4.1",
    "install": "^0.11.0",
    "rxjs": "^5.4.2",
    "zone.js": "^0.8.14"
  },

 "devDependencies": {
    "@angular/cli": "1.3.2",
    "@angular/compiler-cli": "^4.2.4",
    "@angular/language-service": "^4.2.4",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.1.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }

节点版本 - 8.4.0

Npm版本 - 3.10.10

1 个答案:

答案 0 :(得分:0)

尝试:

"angular2-datatable-serverpagination": ">=0.6.3",
"angular2-serverpagination-datatable": ">=1.5.4",

而不是

"angular2-datatable-serverpagination": "^0.6.3",
"angular2-serverpagination-datatable": "^1.5.4",

更改src / tsconfig.app.json,如:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": [],
    "paths": {
      "@angular/*": ["../node_modules/@angular/*"] <=== add this
    }
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

希望这个解决方案有效。