EXCEPTION: Error in :0:0 ORIGINAL EXCEPTION: No provider for RouteRegistry!
Just updated angular2-meteor in my local package and I'm getting this:
common.ts:4 EXCEPTION: Error in :0:0BrowserDomAdapter.logError @ common.ts:4BrowserDomAdapter.logGroup @ common.ts:4ExceptionHandler.call @ common.ts:4(anonymous function) @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:390onInvoke @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:389Zone.run @ angular2-polyfills.js:283NgZoneImpl.runInner @ common.ts:4NgZone.run @ common.ts:4ApplicationRef_.run @ common.ts:4ApplicationRef_.bootstrap @ common.ts:4(anonymous function) @ common.ts:4(anonymous function) @ dynamics_browser.js:51ZoneDelegate.invoke @ angular2-polyfills.js:390onInvoke @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:389Zone.run @ angular2-polyfills.js:283(anonymous function) @ angular2-polyfills.js:635ZoneDelegate.invokeTask @ angular2-polyfills.js:423onInvokeTask @ common.ts:4ZoneDelegate.invokeTask @ angular2-polyfills.js:422Zone.runTask @ angular2-polyfills.js:320drainMicroTaskQueue @ angular2-polyfills.js:541(anonymous function) @ dynamics_browser.js:51
common.ts:4 ORIGINAL EXCEPTION: No provider for RouteRegistry!BrowserDomAdapter.logError @ common.ts:4ExceptionHandler.call @ common.ts:4(anonymous function) @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:390onInvoke @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:389Zone.run @ angular2-polyfills.js:283NgZoneImpl.runInner @ common.ts:4NgZone.run @ common.ts:4ApplicationRef_.run @ common.ts:4ApplicationRef_.bootstrap @ common.ts:4(anonymous function) @ common.ts:4(anonymous function) @ dynamics_browser.js:51ZoneDelegate.invoke @ angular2-polyfills.js:390onInvoke @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:389Zone.run @ angular2-polyfills.js:283(anonymous function) @ angular2-polyfills.js:635ZoneDelegate.invokeTask @ angular2-polyfills.js:423onInvokeTask @ common.ts:4ZoneDelegate.invokeTask @ angular2-polyfills.js:422Zone.runTask @ angular2-polyfills.js:320drainMicroTaskQueue @ angular2-polyfills.js:541(anonymous function) @ dynamics_browser.js:51
common.ts:4 ORIGINAL STACKTRACE:BrowserDomAdapter.logError @ common.ts:4ExceptionHandler.call @ common.ts:4(anonymous function) @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:390onInvoke @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:389Zone.run @ angular2-polyfills.js:283NgZoneImpl.runInner @ common.ts:4NgZone.run @ common.ts:4ApplicationRef_.run @ common.ts:4ApplicationRef_.bootstrap @ common.ts:4(anonymous function) @ common.ts:4(anonymous function) @ dynamics_browser.js:51ZoneDelegate.invoke @ angular2-polyfills.js:390onInvoke @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:389Zone.run @ angular2-polyfills.js:283(anonymous function) @ angular2-polyfills.js:635ZoneDelegate.invokeTask @ angular2-polyfills.js:423onInvokeTask @ common.ts:4ZoneDelegate.invokeTask @ angular2-polyfills.js:422Zone.runTask @ angular2-polyfills.js:320drainMicroTaskQueue @ angular2-polyfills.js:541(anonymous function) @ dynamics_browser.js:51
common.ts:4 Error: DI Exception
at NoProviderError.BaseException [as constructor] (common.ts:4)
at NoProviderError.AbstractProviderError [as constructor] (common.ts:4)
at new NoProviderError (common.ts:4)
at ReflectiveInjector_._throwOrNull (common.ts:4)
at ReflectiveInjector_._getByKeyDefault (common.ts:4)
at ReflectiveInjector_._getByKey (common.ts:4)
at ReflectiveInjector_.get (common.ts:4)
at DebugAppView._View_Conflare_Host0.createInternal (Conflare_Host.template.js:40)
at DebugAppView.AppView.create (common.ts:4)
at DebugAppView.create (common.ts:4)BrowserDomAdapter.logError @ common.ts:4ExceptionHandler.call @ common.ts:4(anonymous function) @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:390onInvoke @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:389Zone.run @ angular2-polyfills.js:283NgZoneImpl.runInner @ common.ts:4NgZone.run @ common.ts:4ApplicationRef_.run @ common.ts:4ApplicationRef_.bootstrap @ common.ts:4(anonymous function) @ common.ts:4(anonymous function) @ dynamics_browser.js:51ZoneDelegate.invoke @ angular2-polyfills.js:390onInvoke @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:389Zone.run @ angular2-polyfills.js:283(anonymous function) @ angular2-polyfills.js:635ZoneDelegate.invokeTask @ angular2-polyfills.js:423onInvokeTask @ common.ts:4ZoneDelegate.invokeTask @ angular2-polyfills.js:422Zone.runTask @ angular2-polyfills.js:320drainMicroTaskQueue @ angular2-polyfills.js:541(anonymous function) @ dynamics_browser.js:51
common.ts:4 ERROR CONTEXT:BrowserDomAdapter.logError @ common.ts:4ExceptionHandler.call @ common.ts:4(anonymous function) @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:390onInvoke @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:389Zone.run @ angular2-polyfills.js:283NgZoneImpl.runInner @ common.ts:4NgZone.run @ common.ts:4ApplicationRef_.run @ common.ts:4ApplicationRef_.bootstrap @ common.ts:4(anonymous function) @ common.ts:4(anonymous function) @ dynamics_browser.js:51ZoneDelegate.invoke @ angular2-polyfills.js:390onInvoke @ common.ts:4ZoneDelegate.invoke @ angular2-polyfills.js:389Zone.run @ angular2-polyfills.js:283(anonymous function) @ angular2-polyfills.js:635ZoneDelegate.invokeTask @ angular2-polyfills.js:423onInvokeTask @ common.ts:4ZoneDelegate.invokeTask @ angular2-polyfills.js:422Zone.runTask @ angular2-polyfills.js:320drainMicroTaskQueue @ angular2-polyfills.js:541(anonymous function) @ dynamics_browser.js:51
common.ts:4 DebugContext {_view: _View_Conflare_Host0, _nodeIndex: 0, _tplRow: 0, _tplCol: 0}
Here is my bootstrapped app component:
import { Component, Injector, enableProdMode, ComponentRef } from '@angular/core';
//import { bootstrap } from '@angular/platform-browser-dynamic';
import { bootstrap } from 'angular2-meteor-auto-bootstrap';
import {
ROUTER_DIRECTIVES,
ROUTER_PROVIDERS,
Routes,
Router
} from '@angular/router';
import {
AlertService,
PermissionsService,
UserService
} from './services/index';
import { ROOT_NAV } from './root-navigation';
@Component({
selector: 'conflare',
directives: [ROUTER_DIRECTIVES],
providers: [AlertService, PermissionsService, UserService],
template: `
<router-outlet></router-outlet>
`
})
@Routes(ROOT_NAV)
export class Conflare {
constructor() {}
}
bootstrap(Conflare, [ROUTER_PROVIDERS])
It's almost as if bootstrap isn't including the router providers.
I fixed the above issue by remove some old dependencies, now I'm having an issue with the bootstrap function if I use the default angular2 function I get TypeError: Cannot read property 'isSkipSelf' of null
and if I use the angular2-meteor-auto-bootstrap I get Uncaught No provider for PlatformRef!
I also have an issue with using Routes after updating to RC1. I've tried everything including the router-deprecated. However if I remove @Routes it works fine.
I figured out the problem, for me there is some issues with how the RC handles providers, you have to put all your services though the bootstrap function rather than through the Components providers array.
So instead of this.
@Component({
selector: 'app',
templateUrl: templateUrl,
providers: [MyService, Router]
})
Do this.
let appProviders = [MyService, Router];
bootstrap(App, appProviders);
This solved the problem for me.
Ok for the router provider, but I think that your services should be registered in the application components.
bootstrap(AppComponent, [HeroService]); // DISCOURAGED (but works)
It will work. It's just not a best practice. The bootstrap provider option is intended for configuring and overriding Angular's own preregistered services, such as its routing support. The preferred approach is to register application providers in application components.
Source: https://angular.io/docs/ts/latest/guide/dependency-injection.html
Cheers, David
@dapids I'm aware, but currently in angular RC1 if I put my services in the provider array it throws the following error. `TypeError: Cannot read property 'isSkipSelf' of null`` hence the reason for putting it in bootstrap.
So, it seems to be related to https://github.com/angular/angular/issues/8519.
closing as it is specifically only angular related