Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

402
Views
Downgraded Angular2 Component getting No provider for ActivatedRoute! error

Currently I have an Angular 2 component that is being downgraded as a directive and used in a bootstrapped hybrid Angular1/Angular2 application. I'm running into an issue when the component is loaded in the browser I get the following error:

No provider for ActivatedRoute!

Note: the following, No provider for ActivatedRoute - Angular 2 RC5 does not cover this use case.

This app still uses all the routing from the bootstrapped Angular 1 app and has been working just fine thus far; I haven't converted the routing to use the Angular 2 routing at this point. One of my requirements in the new component I built was to inspect query parameters. This could be done with the following code:

import { ActivatedRoute } from '@angular/router';

constructor(
        private route: ActivatedRoute)

route.queryParams.subscribe(
    data => this.Id = data['Id']);

The problem I believe is in the fact that the code above relies on the Angular2 router which as I mentioned is not yet being used in my hybrid bootstrapped application. So here is my question:

  • Can I use the code I have above without using the Angular2 router and still inspect the query string parameters? The original Angular1 controller used $routeParams to get querystring information. This wasn't supported in my new Angular2 component. If the answer to the above is I can't use ActivatedRoute because I'm not using the Angular2 router, should I be trying to use this old method or use another; all I need to do is inspect route parameters in my component?
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!