Use this tag for questions specifically about "Routing" with Angular version 7. If you tag your question with this tag, consider also tagging it with the [angular7] tag.
Questions tagged [angular7-router]
108 questions
19
votes
4 answers
How to do unit testing for getCurrentNavigation().extras.state in angular 7
I am trying to write unit test for getCurrentNavigation().extras.state using jasmine.
To solve the issue, I have tried to spy this router method.
My component file,
@Component({
selector: 'app-location-list',
templateUrl:…

Arun G
- 254
- 1
- 4
- 10
11
votes
6 answers
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
I have created an application on angular 7 and ionic 4.
I tried to edit app.routing.ts file, setting path and component. From then on I am getting this error below:
ERROR in ./src/app/department/department.module.ts
[ng] Module build failed (from…

user9885720
- 131
- 1
- 2
- 11
5
votes
4 answers
ERROR Error: Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[FormBuilder]
in my angular app when I add routes in gifts-routing.module.ts this error appears
and when i remove the routes it works
but i still need to route
so how can i solve this error
ERROR Error: Uncaught (in promise): NullInjectorError:…

Kyrillos Mamdoh
- 53
- 1
- 1
- 4
4
votes
1 answer
Angular 7: refreshing page with query parameters causing path mismatch
I'm using Angular 7. I'm trying to navigate to one of the defined urls, passing query parameters:
this.router.navigate(['/someurl'], {queryParams: {r: id}});
as a result of this call, application navigates to localhost:4200/someurl?r=25.
This looks…

dim0_0n
- 2,404
- 5
- 27
- 46
4
votes
1 answer
Switch to another angular component on function calling
I am trying to call a component from another component on function calls.
In my Project, I have a total of two components.
pages/component1/
pages/tables/maintables
as mentioned above I have a total of two components defined in Angular 7.
Now in…

Jayesh Vyas
- 1,145
- 3
- 15
- 35
3
votes
1 answer
How to access _factories property from ComponentFactoryResolver in Angular9 which was available in Angular7?
I used ComponentFactoryResolver to access all the entry component factories and then add routes of those components dynamically in Angular 7.
constructor(private componentFactoryResolver: ComponentFactoryResolver) {
}
var factories =…

Yousaf Khan
- 53
- 8
3
votes
1 answer
Write json data to local JSON file using only angular 7
I have a form on submit of the form I am receiving the json object after form submit. What I am trying is that I have a file data.json in my application folder in "/src/app/data.json". How can I write the data into the JSON file with Node.
Below is…

rji rji
- 697
- 3
- 17
- 37
3
votes
1 answer
Localization using i18n in angular 7 is not working after deployment to Azure
I'm following this link to implement localization in Angular using i18n.
When i navigate to "url/en" or "url/fr", instead of pointing to respective directory folders it is trying to search for a route and giving the below error…

Arshath Shameer
- 453
- 4
- 15
3
votes
1 answer
Update list when route parameter changes
I have a component where I get a route parameter:
export class CatalogComponent implements OnInit {
category: number;
constructor(private route: ActivatedRoute) { }
ngOnInit() {
this.route.paramMap.subscribe(parameters => {
…

Miguel Moura
- 36,732
- 85
- 259
- 481
3
votes
1 answer
Angular 7 - drops slash between app's base url and angular script
I'm writing an Angular-7 app where's it's currently not inserting a "/" between the app name and the Angular javascript that's invoked - but only when it's deployed on the net, not locally.
Edit: I checked "index.html" in the built application,…

Jack BeNimble
- 35,733
- 41
- 130
- 213
3
votes
3 answers
How to navigate the same page using routing in Ionic-4?
I want to navigate the same page using routing in Ionic 4.
I already tried this code but not work properly this.navCtrl.navigateRoot('super');
itemClicked(event) {
this.navCtrl.navigateRoot('super');
}
I expect the page navigate to the same page…

diksha
- 35
- 1
- 6
3
votes
3 answers
How to set base path for static files in Angular 7?
I have tried three approaches.
1st : index.html
2nd : app.module.ts
@NgModule({
providers: [{provide: APP_BASE_HREF, useValue: '/customer'}]
})
3rd : app-routing.module.ts
const routes: Routes = [
{ path: "",…

Ashwini Verma
- 7,477
- 6
- 36
- 56
2
votes
0 answers
I cannot navigate to the dashboard page after logging in keycloak in angular
I get the following error
I added the codes as follows. Keycloak login screen appears. Cannot be redirect after login.
const keycloak_config = config.keycloak;
this.keycloakAuth = Keycloak(keycloak_config);
this.keycloakAuth.redirectUri =…

Kübra
- 187
- 3
- 10
2
votes
4 answers
i am using angular 7 when routerLink not working when i click on anchor button it's not working
in angular 7 i have define different component app folder and define component in route is well when i definde router name in url it,s work fine show me that component which is attached to that url but when i define that rout name in anchor tag…

abubakkar tahir
- 737
- 1
- 11
- 13
2
votes
1 answer
Angular 7 lazy loaded module's component loading twice
I made a very cut down version of our project here:
https://stackblitz.com/edit/angular-double-load-issue
We have a lazy loaded 'client' module, which contains a client-layout component.
Components rendered in client-layout, such as the Home…

Ben Taliadoros
- 7,003
- 15
- 60
- 97