RoutedController

Summary

The abstract class for controllers associated with a route.

Description

The RoutedController abstract class is the abstract base class for controllers that are associated with a route in Altitude MVC/MVP applications.

Examples

Basic Usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import Altitude.Frontend;
import Altitude.Frontend.RouteEngines;
 
external $;
 
class CustomersController : RoutedController
{
    Views.Customers view = new Views.Customers();
    Models.Customers model = new Models.Customers();
 
    public override void registerRoute(IRouter router) {
        router.registerRoute("customers", this.view.show, this.view.hide);
    }
 
    public override void attachViews() {
        this.model.attach(this.view);
    }
 
    public override void listenEvents() {
        $(".customers").click(function() {
            // ...
        });
    }
}
 
// Instantiate a WebBrowserRouter for browser-based routing
WebBrowserRouter router = new WebBrowserRouter();
router.listenEvents();
 
// Instantiate the controller and register the route
CustomersController customersController = new CustomersController();
customersController.attachViews();         // Do not do this in your tests
customersController.listenEvents();        // Do not do this in your tests
customersController.registerRoute(router); // Do not do this in your tests

Methods

  • registerRoute

    The method to override to associate the controller with a route.

Share

HTML | BBCode | Direct Link