new Ractive({...})

edit this page

Initialisation

Ractive instances are created using standard javascript instantiation with the new keyword:

var ractive = new Ractive();

There are no required options, however you'll usually want to specify these base options:

var ractive = new Ractive({
    el: '#container',
    template: '#template',
    data: data
})

The full list of initialisation options is covered here.

Initialising Ractive.extend

Ractive offers an extend method for standard javascript prototypical inheritance:

var MyRactive = Ractive.extend({
    template: '#mytemplate'
})

The same initialisation options can be supplied to the extend method, plus some additional options.

These are instantiated in exactly the same way as above, supplying any additional options:

var ractive = new MyRactive({
    el: '#container',
    data: data
})

See Ractive.extend() for more details.