在另一台机器上安装我的应用程序后,我确实在浏览器端遇到错误:
Uncaught Invalid provider - 只允许 Provider 和 Type 的实例,得到:[object Object]
这似乎与提供者的错误引导有关。但似乎没有什么不对。知道有什么问题吗?
套餐
"@angular/common": "^2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/forms": "^0.2.0",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/router": "^3.0.0-beta.2",
"angular2-meteor": "^0.6.2",
"angular2-meteor-auto-bootstrap": "^0.6.0",
"angular2-meteor-polyfills": "^0.1.1",
"angular2-pagination": "^0.2.1",
"core-js": "^2.4.0",
"es6-shim": "^0.35.1",
"hammerjs": "^2.0.8",
"jquery": "^3.0.0",
"meteor-node-stubs": "~0.2.0",
"reflect-metadata": "0.1.2",
"route-matcher": "^0.1.0",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12"
代码
import 'reflect-metadata';
import 'zone.js/dist/zone';
import { bootstrap } from 'angular2-meteor-auto-bootstrap';
import { Component, provide, PLATFORM_DIRECTIVES } from '@angular/core';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import { APP_BASE_HREF } from '@angular/common';
import { provideRouter, RouterConfig, Routes, ROUTER_DIRECTIVES } from '@angular/router';
import { Home } from '../imports/business/home';
export const routes: Routes = [{ path: '', component: Home, data: {prettyName: 'Accueil'} }];
@Component({
moduleId: module.id,
selector: 'app',
template: require('./app.html').default,
directives: [ROUTER_DIRECTIVES],
})class App{}
bootstrap(App, [
disableDeprecatedForms(),
provideForms(),
provideRouter(routes),
provide(PLATFORM_DIRECTIVES, { useValue: [ROUTER_DIRECTIVES], multi: true })
]);
PS:这不是完全相同的版本,但这里抛出异常https://github.com/vicb/angular/blob/b8450fa68f704f5f7f0f119034f5e4242664b172/modules/angular2/src/core/di/provider.ts#L567
编辑 这显然与我更新的“@angular/router”和“angular2-meteor-auto-bootstrap”版本相关联。他们对 rc.5 有一些依赖关系,显然这个版本更改对我的应用程序不向后兼容。
如果有人有解释...