Ember.js Ribbon Binding Tags

Is there any way to pull the anchor tags from the ember.js infused template? I would like to be able to retrieve only html without any metamorphic script tags.

I have this related question , but he wanted to ask this more general question.

+4
source share
3 answers

If someone needs this functionality, I created a small jquery plugin for this:

 # Small extension to create a clone of the element without # metamorph binding tags and ember metadata $.fn.extend safeClone: -> clone = $(@).clone() # remove content bindings clone.find('script[id^=metamorph]').remove() # remove attr bindings clone.find('*').each -> $this = $(@) $.each $this[0].attributes, (index, attr) -> return if attr.name.indexOf('data-bindattr') == -1 $this.removeAttr(attr.name) # remove ember IDs clone.find('[id^=ember]').removeAttr('id') clone 

Still hope there is a better way.

+2
source

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

Work is underway on the #unbound auxiliary block, which would be good for what you are trying to do: https://github.com/emberjs/ember.js/pull/321

Another approach is to provide a simple Handlebars template in your views. None of the output will be linked.

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

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

+7
source
+3
source

Source: https://habr.com/ru/post/1390149/


All Articles