Open reboottime opened 1 year ago
Keep URLs Simple and Readable:
Prefer not using #! if possible, as #! is not ideal for SEO
Consistent Structure:
Use Redirects Appropriately: Users may have bookmarked outdated URLs, leading them to visit legacy URLs directly from their browser bookmarks. By implementing redirects for these legacy URLs, we recover users from mistake.
In this example, we are using the "orders" resource as a demonstration for designing URLs in an Angular Single Page Application (SPA).
/orders
/orders/detail/:order-id
/orders/edit/:order-id
/orders/create
In single page applications, route protection plays a critical role in ensuring secure access to different parts of the application. Let's consider the following two senariaos:
For the above two cases,
A growing Single Page Application can be unwieldy. Without code splitting, the initial 'main.ts' can be overly large, slowing down the initial screen rendering.
Splitting code on based on routing could significantly reduce bundle size then reduces first screen rendering time.
In single page application, features are best represented by distinct routing URL. Organizing features using modular approach allows developers to conveniently relocate code.
As it brings following benefits:
Sample Code: Organize Settings module
Overview
This article discusses the routing essentials of large Angular applications, with content organized in two parts:
Part I: URL Design for Single Page Applications
Part II: Common Routing Requirements
References