Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember.js Strip Binding Tags

Tags:

ember.js

Is there a way to strip binding tags from an ember.js infused handlebars template? I would like to be able to extract just the html without any of the metamorph script tags.

I have this related question but wanted to ask this more general question as well.

like image 882
ghempton Avatar asked Dec 17 '22 05:12

ghempton


2 Answers

You can use the unbound Handlebars helper to do this at the individual property level.

There is work being done on an #unbound block helper, which would be nice for what you're trying to do: https://github.com/emberjs/ember.js/pull/321

Another approach is to, in your views, specify a plain Handlebars template. None of the output will be bound.

App.UnboundView = Ember.View.extend({
  template: Handlebars.compile("output is: {{msg}} here"),
  msg: "not bound"
});

Here's a jsFiddle example: http://jsfiddle.net/ebryn/zQA4H/

like image 121
ebryn Avatar answered Dec 25 '22 14:12

ebryn


Here's a better way

{{unbound propertyName}}

http://emberjs.com/api/classes/Ember.Handlebars.helpers.html#method_unbound

like image 42
Denzo Avatar answered Dec 25 '22 14:12

Denzo