Questions tagged angular2-routing

Explore the latest questions and answers asked by our top developers.

Angular router outlet & wildcard issue

Example of a working code const routes: Routes = [ { path: ”, component: WorkstationTemplateComponent, children: [ { path: ”, outlet: ‘workstation’, loadChildren: () => import(‘./modules/root-content/root-content.module’).then(m => m.RootContentModule) }, { path: ‘**’, component: RouterNotFoundComponent, } ], }, ]; Now if I try to add outlet to wildcard, same as previous array index, it does not […]

By Ivan Moroz
Published
Categorized as angular, angular13, angular2-routing Tagged , ,

Angular loading component based on route parameter

I want to load component based on URL parameter when the user clicks on a link in the home component. For exmaple user is at "/home" which have a list of links Link 1 Link 2 When the user clicks on Link 1 or 2, I want to load the details component and the url […]

By Max
Published
Categorized as angular, angular2-routing, javascript Tagged , ,

this.http.get return not found just on app module

On Angular 11, I am calling an endpoint in my service getServerTime() { return this.http.get(environment.api.serverTime); } injecting above service into app.component this.serviceA.getServerTime().subscribe((serverTime: any) => { this.offset = new Date().getTime() – serverTime; }); thorws } ​ message: " Http failure response for https://url/ntp: 500 undefined however if i put all the code in a component that […]

angular routerLink redirects to component as expected, but later router.url not returning current URL

I have a link in my navbar About when I click on it from my homepage (/), browser redirects to /about route(About component) in my application(without reloading the page/tab) which is what I am looking for. In the component About I have a requirement where I need to load the content dynamically depending on the […]

By Phani
Published
Categorized as angular, angular2-routing Tagged ,

No provider for InjectionToken Global Config! error

After updating from angular 11 to 13 all my child routes became broken and i am getting this error ERROR NullInjectorError: R3InjectorError(ArchViewModule)[InjectionToken Global Config -> InjectionToken Global Config -> InjectionToken Global Config -> InjectionToken Global Config -> InjectionToken Global Config -> InjectionToken Global Config]: NullInjectorError: No provider for InjectionToken Global Config! at NullInjector.get (core.mjs:11105) at […]

By Ioannis Mikhailidis
Published
Categorized as angular, angular2-routing Tagged ,

Angular fragment and hashLocationStrategy does not work

In my Angular 10 project, I’m trying to use fragment in my navbar to send users to different sections in about us page. I’ve tried adding { useHash: true } to RouterModule.forRoot(routes) in my app-routing.module.ts. These two buttons are supposed to take me to different parts of the about us page: <button mat-menu-item routerLink="/about-us" fragment="token_details"> […]

By Newsha Nik
Published
Categorized as angular, angular2-routing Tagged ,

Type ‘string’ is not assignable to type ‘LoadChildrenCallback

I am using Angular 13 and created a myapp.mainrouting.js file and trying to declare loadChildren as below: import {CustomerAppHomeComponent} from "../Home/CustomerApp.HomeComponent"; import {Routes} from "@angular/router"; export const MainRoutes: Routes = [ { path: ‘Home’, component: CustomerAppHomeComponent }, { path: ‘Supplier’, loadChildren: ‘../Supplier/CustomerApp.SupplierModule#CustomerAppSupplierModule’ }, { path: ”, component: CustomerAppHomeComponent }, ] However, I am getting below […]

Why is the component only created twice?

I have a separate module with a routing module imported into it, in which the routes look like: const routes: Routes = [ { path: ”, children: [ { path: ‘orders’, component: MainComponent, children: [ { path: ”, component: OrdersComponent, pathMatch: ‘full’, }, { path: ‘:orderNumber’, component: OrdersComponent, }, ], } ], }]; this.location: Location, […]

By Alexander Ivleev
Published
Categorized as angular, angular2-routing Tagged ,

Angular routing with lazy loading

I am getting the following error core.js:6210 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: ‘home/product’ Error: Cannot match any routes. URL Segment: ‘home/product’ at ApplyRedirects.noMatchError (router.js:2628) at CatchSubscriber.selector (router.js:2610) at CatchSubscriber.error (catchError.js:27) at MapSubscriber._error (Subscriber.js:75) at MapSubscriber.error (Subscriber.js:55) at MapSubscriber._error (Subscriber.js:75) at MapSubscriber.error (Subscriber.js:55) at ThrowIfEmptySubscriber._error (Subscriber.js:75) at ThrowIfEmptySubscriber.error (Subscriber.js:55) […]

By study clan
Published
Categorized as angular, angular2-routing Tagged ,

Run Angular 12 inside JavaFX – NavigationError

We’re trying to run our Angular 12 page in a external application with a JavaFx Webview. The initial html, js successfully loads and navigates to the login page, but it seems that manual navigation by the router (for example after logging in) doesn’t work. The logs of javafx show the following issues: TRACE – processing […]

1 2 3 14

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq