question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Component Router does not work with Upgrade Adapter

See original GitHub issue

When trying to use the Angular 2 Component Router (Angular 2 RC 4) with the upgrade adapter I got the following error:

Bootstrap at least one component before injecting Router. at setupRouter

This is my main.ts file:

angular.module(moduleName).directive('App', upgradeAdapter.downgradeNg2Component(AppComponent));

upgradeAdapter.addProvider(APP_ROUTER_PROVIDERS);

upgradeAdapter.bootstrap(document.body, [moduleName]);

I google the problem and found the following links, but they all correspond to the router deprecated module as the Angular team changed how the router works since RC4:

https://github.com/angular/angular/issues/7147?_pjax=%23js-repo-pjax-container

Any ideas?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

7reactions
brandonrobertscommented, Jul 8, 2016

@ptomaszi provideRouter is being deprecated as of RC5, so as a disclaimer this is subject to change but since you’re using ngUpgrade, you’ll need to override the ApplicationRef in the providers of your AppComponent

Plunker: http://plnkr.co/edit/vpLkEY?p=preview

1reaction
dezoxelcommented, Nov 26, 2016

"@angular/router": "3.1.1" doesn’t call initial navigation automatically.

Calling initialNavigation() in AppComponent fixed the issue:

...
export class AppComponent {
  constructor(router: Router) {
    router.initialNavigation();
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

React Router stop working after upgrade React - Stack Overflow
0.0 to the last version to use Hook, after the upgrade, React Router stop working. This is the AppRoute code: import React from...
Read more >
Troubleshoot Router Interface Issues - Cisco
This document describes how to troubleshoot interfaces that are down on router ethernet links.
Read more >
7 Ways to Fix “Default Gateway Is Not Available” Error
How to Fix the Error · Go to the device manager on your PC. · Then expand the network adapter option by right-clicking...
Read more >
How to get back online after a Windows 10 update breaks ...
In this guide, we'll walk you through the troubleshooting steps to fix network connectivity issues after installing an update on Windows 10.
Read more >
Wi-Fi Adapter Is Disabled or Is Not Working - Intel
Update firmware on your wireless access point's Wi-Fi modem, router, or extender. Old firmware can cause this issue as the adapter will disable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found