Rose Perrone
Rose Perrone

Reputation: 63526

Ember view without handlebars

How can I create a view in Ember that uses plain 'ol HTML rather than a handlebars template? I'm using a graphing library called Rickshaw, and I want to be able to call its "render" function, which draws to the screen, but I can't execute javascript within a handlebars template.

Upvotes: 2

Views: 504

Answers (1)

Myslik
Myslik

Reputation: 1178

You could try something like this:

App.GraphView = Ember.View.extend({
    didInsertElement: function () {
        var graph = new Rickshaw.Graph({
            element: this.$().get(0),
            series: [] // DATA
        }):
        graph.render();
    }
});

didInsertElement is called once the view is inserted into DOM and by calling this.$().get(0) you can get its base DOM element.

Upvotes: 2

Related Questions