Jeremy Massel
Jeremy Massel

Reputation: 2267

How do I bind unescaped values on an Ember.Select

See example here: http://jsbin.com/OfigaJo/1/edit

The gist of the issue is that I can use the triple handlebars to do this by hand, but I can't find any documentation on how to do the same with an Ember.Select view.

I need the indentation to work in order to show hierarchy within the list. An optgroup wouldn't work in this case because the headers aren't selectable, and I need them to be. Also, I could just use a hyphen, but visually that gets painful pretty quickly.

Upvotes: 1

Views: 372

Answers (1)

intuitivepixel
intuitivepixel

Reputation: 23322

A possible way you can do something like this would be to wrap the strings in your array in Handlebars.SafeString before you return it as the model for the select view:

App.IndexRoute = Ember.Route.extend({
  model: function() {
    var colors = ['colors', ' red', ' yellow', ' blue', 'shapes', ' square', ' circle'];
    var safeStrings = colors.map(function(color) {
      return new Handlebars.SafeString(color);
    });
    return safeStrings;
  }
});

See here for a working demo.

Hope it helps.

Upvotes: 1

Related Questions