解決した

Angular 2 Release "予期しない値 'ElementRef'がモジュールによってインポートされました"

フロントエンド

Angular 2のリリースにアップグレードし、ElementRefを使用しようとしています。 最初にAngular2 RC5 error:zone.js: Unhandled Promise rejection: No provider for ElementRefここに指定されているAngular2 RC5 error:zone.js: Unhandled Promise rejection: No provider for ElementRefAngular2 RC5 error:zone.js:未処理プロミス拒否:ElementRefのプロバイダがありません

import { NgModule, CUSTOM_ELEMENTS_SCHEMA, ElementRef }       from '@angular/core';
@NgModule({
    declarations: [DashboardComponent, WidgetBankComponent, DataTableDirectives, OrderBy],
    exports: [DashboardComponent, WidgetBankComponent],
    imports: [BrowserModule, HttpModule, FormsModule, ChartsModule, ElementRef],
    providers: [ChartService, GridService, WidgetsControlService, GridViewService, ApplicationSettingsService, DataService, ToolsService, LocalStorageService, RuntimeCompiler, COMPILER_PROVIDERS, NgGrid, NgGridItem],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})

今、私はエラー(SystemJS) Unexpected value 'ElementRef' imported by the module 'DashboardModule'取得しています。 (SystemJS) Unexpected value 'ElementRef' imported by the module 'DashboardModule'

何か案は?

前もって感謝します!

EDIT

以下の答えで提案された修正がこのエラーを持っていましたか?ここでは完全なエラーです - このエラーからプロバイダを供給する必要がある場所を教える方法はありますか?

zone.js:355 Unhandled Promise rejection: No provider for ElementRef! ; Zone: <root> ; Task: Promise.then ; Value: NoProviderError {_nativeError: Error: No provider for ElementRef!
    at NoProviderError.Error (native)
    at NoProviderError.Base…, keys: Array[1], injectors: Array[1]}_nativeError: Error: No provider for ElementRef!
    at NoProviderError.Error (native)
    at NoProviderError.BaseError [as constructor] (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:1248:38)
    at NoProviderError.AbstractProviderError [as constructor] (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:1703:20)
    at new NoProviderError (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:1734:20)
    at ReflectiveInjector_._throwOrNull (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:3331:23)
    at ReflectiveInjector_._getByKeyDefault (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:3359:29)
    at ReflectiveInjector_._getByKey (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:3322:29)
    at ReflectiveInjector_.get (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:3131:25)
    at NgModuleInjector.AppModuleInjector.createInternal (AppModule.ngfactory.js:310:75)
    at NgModuleInjector.create (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:7192:80)constructResolvingMessage: (keys)injectors: Array[1]keys: Array[1]message: (...)name: (...)stack: (...)__proto__: AbstractProviderError Error: No provider for ElementRef!
    at NoProviderError.Error (native)
    at NoProviderError.BaseError [as constructor] (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:1248:38)
    at NoProviderError.AbstractProviderError [as constructor] (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:1703:20)
    at new NoProviderError (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:1734:20)
    at ReflectiveInjector_._throwOrNull (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:3331:23)
    at ReflectiveInjector_._getByKeyDefault (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:3359:29)
    at ReflectiveInjector_._getByKey (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:3322:29)
    at ReflectiveInjector_.get (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:3131:25)
    at NgModuleInjector.AppModuleInjector.createInternal (AppModule.ngfactory.js:310:75)
    at NgModuleInjector.create (http://localhost:56159/node_modules/@angular/core//bundles/core.umd.js:7192:80)consoleError @ zone.js:355_loop_1 @ zone.js:382drainMicroTaskQueue @ zone.js:386ZoneTask.invoke @ zone.js:308
zone.js:357 Error: Uncaught (in promise): Error: No provider for ElementRef!(…)consoleError @ zone.js:357_loop_1 @ zone.js:382drainMicroTaskQueue @ zone.js:386ZoneTask.invoke @ zone.js:308

Progress 100%

一番いい

回答

フロントエンド

imports配列からElementRefを削除し、それをproviders配列に貼り付けproviders

import { NgModule, CUSTOM_ELEMENTS_SCHEMA, ElementRef } from '@angular/core';
@NgModule({
    declarations: [DashboardComponent, WidgetBankComponent, DataTableDirectives, OrderBy],
    exports: [DashboardComponent, WidgetBankComponent],
    imports: [BrowserModule, HttpModule, FormsModule, ChartsModule],
    providers: [ChartService, GridService, WidgetsControlService, GridViewService, ApplicationSettingsService, DataService, ToolsService, LocalStorageService, RuntimeCompiler, COMPILER_PROVIDERS, NgGrid, NgGridItem, ElementRef],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})