Showing all posts from multiple categories

2025-04-19 05:22:41

Explain Routing in Angular

The Angular router is the main foundation of the the platform. It lets developers create Single Page Applications with several views and switch between them. The @angular/router package contains Angular Router, is sophisticated routing library with multiple router outlets, path matching algorithms, easy route parameter access, and route guards to protect components.

2025-04-19 06:09:22

How Routing handles in Angular

 

Key Components of Angular Routing:

Routes (Route Configuration):

  • This is an array of JavaScript objects that define the mapping between URL paths and the components that should be displayed.
  • Each route object typically has:
    • path: The URL segment. This can be static (e.g., 'home'), dynamic with parameters (e.g., 'products/:id'), or a wildcard ('**') for a 404 page.
    • component: The Angular component to render when the path matches.
    • redirectTo: Used to redirect from one path to another.
    • children: For defining nested (child) routes.
    • loadChildren: For lazy loading modules.

2025-04-23 15:12:04

Routing in ASP.NET MVC

Conventional routing: this sort of routing is defined by calling the MapRoute method, by setting its unique name, URL pattern, and a few default settings.

  • URL routing will consider the domain name. The URL pattern "{controller}/{action}/{id}" resembles localhost:1234/{controller}/{action}/{id}. 
  • The default controller and action method will be used to handle requests when the URL does not contain any more information following the domain name.
  • When ASP.NET MVC starts, it registers one or more patterns with the framework route table to tell the routing engine what to do with requests matching those patterns. When a request is received by the routing engine during runtime, it checks the URL against its URL patterns and returns the response.

 

Attribute-based routing is defined by specifying the Route attribute in the controller's action method.