Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

401
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda