News Articles angular-router

Angular child route keeps redirecting to parent

I’m trying to add child routes to a sidebar menu using Angular 12. When I click on a child route link it briefly goes to the child component then automatically redirects back to the parent component. I can’t figure out why. I declare all of my routes in the parent component’s routing module: const routes: […]

Set Active Border Color in Angular

I need to put a border line on the right if my a menu item is active. I’m using Angular and Tailwind. Code <div *ngFor="let item of menuItems"> <a class=" w-full text-gray-800 dark:text-white flex items-center justify-start p-2 transition-colors duration-200 " routerLink="[item.route]" routerLinkActive="border-r-4 border-green-400" > <span> <img [src]="item.icon" /> </span> <span class="mx-6 text-sm font-normal">{{ item.name }}</span> […]

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.