URL Routing
UI-Router provides powerful URL routing capabilities with parameter support, pattern matching, and custom routing rules.URL Configuration Basics
Define URLs in state declarations:URL Patterns
Static URLs
Path Parameters
Capture variable path segments:Typed Parameters
Specify parameter types:Query Parameters
Define parameters after?:
Optional Parameters
All query parameters are optional by default:Catch-All Parameters
Match remaining path segments:URL Matching
Strict vs Non-Strict
Control trailing slash behavior:Case Sensitivity
URL Rules
URL rules provide flexible routing beyond state URLs.Default Rule
Set a fallback state:URL Rewrites
Rewrite URLs before matching:Custom Rules
Create advanced routing rules:Rule Priority
Rules are processed in registration order:URL Synchronization
Defer Intercept
Delay URL synchronization:Manual Sync
Manually trigger URL matching:Listen Control
URL Service API
Get/Set URL
URL Parts
Generate URLs
URL Configuration
Base HREF
Set the base path:HTML5 Mode
Configure pushState vs hash mode:Advanced Patterns
Multi-Segment Parameters
Optional Path Segments
Regular Expression Parameters
Matrix Parameters (Experimental)
Debugging URLs
URL Matching
Current URL Info
Best Practices
// Good
url: '/products?category&minPrice&maxPrice'
// Avoid - path params for optional data
url: '/products/:category/:minPrice/:maxPrice'
Common Issues
Trailing Slashes
Parameter Type Mismatch
Overlapping URLs
Related Documentation
- State Configuration - Define state URLs
- Parameters - URL parameter configuration
- Navigation - URL-based navigation
- Nested States - URL composition
API Reference
- UrlService - URL service API
- UrlRules - URL rules management
- UrlMatcher - URL pattern matching
- UrlConfig - URL configuration