Allows a view and/or controller to be configured for a URL.

RouteProvider is used in conjuction with the view directive.

RouteProvider is only accessible as the argument to the ConfigureRoutes() method on the Acute.App class. It can not be injected as a dependency to services.

Methods

RouteProvider When(string path, RouteConfig routeConfig)

Configures a new route.

Parameters

Param Type Details
path string The route path to be matched against ILocation.Path. If ILocation.Path contains redundant trailing slash or is missing one, the route will still match and the ILocation.Path will be updated to add or drop the trailing slash to exactly match the route definition.
routeConfig Acute.RouteConfig Route configuration details.
RouteProvider Otherwise(RouteConfig routeConfig)

Sets the route definition that will be used on route change when no other route definition is matched.

Parameters

Param Type Details
routeConfig Acute.RouteConfig Route configuration details.

RouteConfig Acute.RouteConfig

Contains the route-mapping configuration information.

Properties

string TemplateUrl { get; set; }

Path to the HTML template to be used by the view directive.

Type Controller { get; set; }

The controller type to be associated with the URL.

Tip: Use the generic RouteConfig<TController> rather than having to set the Controller property.