Angular2-Meteor:@Injectable装饰器无法正常工作

时间:2016-09-01 06:49:14

标签: angular2-meteor

我正在创建一个Angular2-Meteor项目。我把它设置为使用Angular 2 RC5。一切都运行良好,直到我尝试使用@injectable()装饰器添加服务。一旦添加,我就收到一个流星编译错误:

  使用类装饰器时需要

reflect-metadata shim

一旦我删除@injectable()装饰器,Meteor会编译所有内容,我可以加载我的应用程序。

我安装了barbatus:angular2-polyfills软件包,我认为只需要导入所需的zone.js和reflect-metadata软件包。有人建议在main.ts的顶部使用导入,但这不起作用。

@NgModule和@component装饰器正常运行。由于我还没有将服务(使用@injectable装饰器)连接到我的@ngmodule,我认为这表明Meteor环境根本没有按照预期处理@injectable装饰器。无论是否使用它。

非常感谢任何有关如何解决此问题的建议或想法。

JT

安装的流星包是:

meteor-base@1.0.4             # Packages every Meteor app needs to have
mobile-experience@1.0.4       # Packages for a great mobile UX
mongo@1.1.12                   # The database Meteor supports right now
reactive-var@1.0.10            # Reactive variable for tracker
jquery@1.11.9                  # Helpful client-side library
tracker@1.1.0                 # Meteor's client-side reactive programming library
standard-minifier-css@1.2.0   # CSS minifier run for production mode
standard-minifier-js@1.2.0    # JS minifier run for production mode
es5-shim@4.6.14                # ECMAScript 5 compatibility for older browsers.
ecmascript@0.5.8              # Enable ECMAScript2015+ syntax in app code

autopublish@1.0.7             # Publish all data to the clients (for prototyping)
insecure@1.0.7                # Allow all DB writes from clients (for prototyping)
angular2-compilers
barbatus:angular2-runtime
practicalmeteor:mocha
xolvio:cleaner
hwillson:stub-collections
dispatch:mocha-phantomjs
shell-server
barbatus:angular2-polyfills

安装package.json的npm包是:

  "dependencies": {
    "@angular/common": "2.0.0-rc.5",
    "@angular/compiler": "2.0.0-rc.5",
    "@angular/core": "2.0.0-rc.5",
    "@angular/forms": "^0.3.0",
    "@angular/platform-browser": "2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "2.0.0-rc.5",
    "@angular/router": "^3.0.0-rc.1",
    "@angular2-material/button": "^2.0.0-alpha.7-4",
    "@angular2-material/card": "^2.0.0-alpha.7-4",
    "@angular2-material/checkbox": "^2.0.0-alpha.7-4",
    "@angular2-material/core": "^2.0.0-alpha.7-4",
    "@angular2-material/input": "^2.0.0-alpha.7-4",
    "@angular2-material/toolbar": "^2.0.0-alpha.7-4",
    "angular2-meteor": "^0.7.0-beta.1",
    "angular2-meteor-auto-bootstrap": "^0.6.0",
    "angular2-meteor-polyfills": "^0.1.1",
    "angular2-meteor-tests-polyfills": "^0.0.2",
    "bcrypt": "^0.8.7",
    "es6-shim": "0.35.1",
    "meteor-node-stubs": "0.2.3",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "0.6.12"
  },
  "devDependencies": {
    "chai": "3.5.0",
    "chai-spies": "0.7.1",
    "codelyzer": "latest",
    "tslint": "latest",
    "typescript": "latest",
    "typings": "latest"
  }

1 个答案:

答案 0 :(得分:0)