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 useActivatedRoute
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?