registerRoute

Summary

Registers a route.

Signatures

Click on a signature to select it and view its documentation.

Usage

public override void registerRoute(string hash, void() show, void() hide)

Parameters

hash

The hash (sans the # symbol) to associate the route with.

show

The method to call when the route should be shown.

hide

The method to call when the route should be hidden.

Description

Registers a route with the associated hash (do not include the # symbol).

Once a route becomes "active", the show method will be called. In addition, all inactive routes will have their hide method called.

Route parameters are available with the following syntax:

  • user/:id
  • route/:param1/:param2

Examples

Basic Usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import Altitude.Frontend;
import Altitude.Frontend.RouteEngines;
 
external $;
 
class CustomersView
{
    public void show() { $(".customers").show(); }
    public void hide() { $(".customers").hide(); }
}
 
class CustomersController : RoutedController
{
    CustomersView view = new CustomersView();
 
    public override void registerRoute(IRouter router) {
        router.registerRoute("customers", this.view.show, this.view.hide);
    }
}

Share

HTML | BBCode | Direct Link