View (Constructor)

Summary

Constructs a view and binds it to the specified Handlebars template.

Usage

public View(string template)

Parameters

template

A Handlebars template.

Description

Constructs a view and binds it to the specified Handlebars template.

Examples

Basic Usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import Altitude.Frontend;
 
external jQuery, $; // Import jQuery (optional)
 
class Contact : View
{
    // Construct a view based on the specified template
    Contact() {
        super(
            """
            <div class="contact">{{firstName}} {{lastName}}</div>
            """
        );
    }
 
    // Describe how the HTML gets rendered once the model changes
    override renderTemplate(string html) {
        $("#contact").html(html);
    }
}

Share

HTML | BBCode | Direct Link