Angular2从beta15更新为beta16

Angular2从beta15更新为beta16,angular,polyfills,Angular,Polyfills,编辑my package.json并运行npm install后,当我尝试在浏览器中运行我的应用程序时,出现以下错误: angular2-polyfills.min.js:1 Unhandled Promise rejection: Error: Trying to create a class provider but "undefined" is not a class! at new BaseException (http://localhost:3000/angular2

编辑my package.json并运行npm install后,当我尝试在浏览器中运行我的应用程序时,出现以下错误:

angular2-polyfills.min.js:1 Unhandled Promise rejection: Error: Trying to create a class provider but "undefined" is not a class!
        at new BaseException (http://localhost:3000/angular2/src/facade/exceptions.js:17:23)
        at ProviderBuilder.toClass (http://localhost:3000/angular2/src/core/di/provider.js:197:19)
        at Object.eval (http://localhost:3000/js/app.js:62:44)
        at eval (http://localhost:3000/js/app.js:67:4)
    Evaluating http://localhost:3000/js/app.js
    Error loading http://localhost:3000/js/app.js ; Zone: <root> ; Task: Promise.then ; Value: Error: Error: Trying to create a class provider but "undefined" is not a class!(…)
第二次编辑:

{
  "name": "angular2-express-starter",
  "version": "1.0.0",
  "description": "Starter application of Angular2 on Express",
  "main": "gulpfile.js",
  "private": true,
  "scripts": {
    "watch": "gulp watch",
    "start": "node ./server/bin/www",
    "postinstall": "gulp"
  },
  "author": "Benjamin McFerren",
  "license": "",
  "dependencies": {
    "angular2": "2.0.0-beta.17",
    "body-parser": "~1.13.2",
    "cookie-parser": "~1.3.5",
    "del": "^2.2.0",
    "es6-promise": "^3.1.2",
    "es6-shim": "^0.35.0",
    "express": "^4.13.4",
    "gulp": "^3.9.1",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-tslint": "^3.6.0",
    "gulp-typescript": "^2.11.0",
    "jsonwebtoken": "^5.5.4",
    "morgan": "~1.6.1",
    "ng-semantic": "^1.0.15",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.6",
    "serve-favicon": "~2.3.0",
    "systemjs": "^0.19.20",
    "zone.js": "0.6.12"
  },
  "devDependencies": {
    "underscore": "^1.8.3"
  }
}

编辑三:

app.ts

从“angular2/core”导入{Component,View,bind};
从“angular2/HTTP”导入{HTTP_PROVIDERS};
从“angular2/platform/browser”导入{bootstrap};
从“angular2/ROUTER”导入{ROUTER_提供程序、RouterOutlet、LocationStrategy、RouteConfig、HashLocationStrategy};
从“/components/Container/Container”导入{Container}”;
从“/service/dataservice”导入{DATA_BINDINGS}”;
导入。。。
...
@组成部分({
选择器:“应用程序”,
指令:[RouterOutlet],
模板:``
})
@线路图([
{组件:容器,路径:“/”},
...
])
引导程序(AppComponent[
路由器供应商,
//[HTTP_提供者,提供(RequestOptions,{useClass:MyOptions}],
HTTP_提供商,
数据绑定,
...
绑定(LocationStrategy).toClass(HashLocationStrategy)
]);
dataservice.ts

从“angular2/core”导入{Injectable,EventEmitter};
从“angular2/Http”导入{Http};
从“angular2/路由器”导入{Location};
从“rxjs/Observable”导入{Observable};
导入“rxjs/Rx”;
...
@可注射()
导出类数据服务{
结果:对象;
错误:对象;
http:http;
项目:阵列;
...
构造函数(http:http,
地点:地点,,
公众。。。,
...) {
...
}
...
}
导出变量数据\u绑定:数组=[
数据服务
];

位置
-相关位已移动

import {  
  PlatformLocation,  
  Location,  
  LocationStrategy,  
  HashLocationStrategy,  
  PathLocationStrategy,  
  APP_BASE_HREF}  
from 'angular2/platform/common'

另请参见

请显示导致此错误消息的代码。刚才添加的-我有点困惑,因为我从tsI编译的源代码需要查看导致此异常的更多TS代码。导入有问题,或者可能缺少
forwardRef()
或提供程序存在其他问题。
Injector
在b16中重命名为
ReflectiveInjector
-您是否在代码中的任何位置导入和使用
Injector
,问题标题说这是关于升级到beta16的,但是您的package.json列出了beta17。。。
import { Component, View, bind } from "angular2/core";
import { HTTP_PROVIDERS } from "angular2/http";
import { bootstrap } from "angular2/platform/browser";
import { ROUTER_PROVIDERS, RouterOutlet, LocationStrategy, RouteConfig, HashLocationStrategy } from "angular2/router";

import { Container } from "./components/container/container";

import {DATA_BINDINGS} from "./service/dataservice";
import ...
...

@Component({
    selector: "app",
    directives: [RouterOutlet],
    template: `<router-outlet></router-outlet>`
})
@RouteConfig([
    { component: Container, path: "/" },
    ...
])


bootstrap(AppComponent, [
    ROUTER_PROVIDERS,
    // [HTTP_PROVIDERS, provide(RequestOptions, {useClass: MyOptions})],
    HTTP_PROVIDERS,
    DATA_BINDINGS,
    ...
    bind(LocationStrategy).toClass(HashLocationStrategy)
]);
import {Injectable, EventEmitter} from "angular2/core";
import {Http} from "angular2/http";
import {Location} from "angular2/router";
import {Observable} from "rxjs/Observable";
import "rxjs/Rx";

...


@Injectable()
export class DataService {

    result: Object;
    error: Object;
    http: Http;
    items: Array<any>;
    ...

    constructor(http: Http,
                location: Location,
                public ...,
                ...) {

         ...


    }
     ...
}

export var DATA_BINDINGS: Array<any> = [
    DataService
];
import {  
  PlatformLocation,  
  Location,  
  LocationStrategy,  
  HashLocationStrategy,  
  PathLocationStrategy,  
  APP_BASE_HREF}  
from 'angular2/platform/common'