Skip to main content

All Questions

0 votes
2 answers
52 views

Router-outlet not loading first component as expected

On my new angular project I have the following app.routes.ts file: import { Route } from '@angular/router'; export const APP_ROUTES: Route[] = [ { path: 'main', loadComponent: () =...
joaovzg's user avatar
  • 50
1 vote
1 answer
141 views

How do I apply the `canActivateFn` to all routes in a standalone Angular application?

In module-based applications, to add a guard to all routes at once, i can pass it as the second parameter to the RouterModule.forRoot function. RouterModule.forRoot(routes, { canActivate: [AuthGuard] }...
Vlad's user avatar
  • 26
0 votes
0 answers
119 views

Angular 17: Issues with Admin Module Routing and Standalone Components

`Hey everyone, I'm currently working on an Angular project, and I'm facing some challenges with routing within my admin module. Specifically, I'm encountering issues when navigating to child routes ...
Ahmed KAABAR's user avatar
0 votes
0 answers
98 views

I have an Angular SSG app that fetches data from a 3rd party API during initialization that doesn't work when navigating

I have an Angular V17 standalone app that fetches blog posts from a 3rd party API during initialization. The server side rendering work fines and the HTML that gets sent over contains the information ...
anthonyb's user avatar
  • 373
9 votes
4 answers
9k views

How to register nested routes on an Angular standalone component?

I need to migrate the component/view below (with nested routes) from NgModule to standalone Angular docs for routing do not mention standalone, and standalone docs only show how to route to a ...
Abderrahim's user avatar
22 votes
1 answer
11k views

How to import a NgModule library with forRoot() to an Angular standalone component?

I'm currently working on an Angular application (version 16.1.3) which utilizes standalone components. This application also relies on an Angular library that uses NgModules. I'm attempting to import ...
Florian Goebel's user avatar
0 votes
1 answer
2k views

RouterTestingModule.withRoutes in a test of Angular standalone component

After migrating to standalone components in Angular, how do we mock testing routes? Let's consider a component @Component({ standalone: true, imports: [RouterModule] template: `<a [routerLink]=&...
George Knap's user avatar
  • 1,220