Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

403
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda