Metamorphic script tags are added to the value attribute in Ember / Sproutcore 2.0

I have the following controller that contains a view:

Lead.Controllers.UrlSearch = Ember.Object.extend init: -> @_super() @url_search = Lead.UrlSearch.create() @url_search.set('search_url', 'http://www.bdec-online.com/bd-cmpy/bd-cz.cfm') @view = Ember.View.create controller: @ urlSearchBinding: 'controller.url_search' templateName: 'app/templates/url_search/show' @view.appendTo('#fieldset') 

The template in app / templates / url_search / show is as follows

 <label for="url_search_url">Url</label> <input id="url_search_url" name="url_search[url]" size="30" type="search" value="{{urlSearch.search_url}}"> <button class="button" id="goButton" type="button">GO</button> 

The view renders perfectly, except for the value parameter, which has metamorph script tags as follows:

 <input id="url_search_url" name="url_search[url]" size="30" type="search" value="&lt;script id='metamorph-0-start' type='text/x-placeholder'&gt;&lt;/script&gt;http://www.bdec-online.com/bd-cmpy/bd-cz.cfm&lt;script id='metamorph-0-end' type='text/x-placeholder'&gt;&lt;/script&gt;"> 

Anyway, can I stop these script tags by getting rendered, or is there somewhere in the setting to stop this?

+4
source share
2 answers

This is why the {{bindAttr}} helper is available. This should do the job for you:

 <input id="url_search_url" name="url_search[url]" size="30" type="search" {{bindAttr value="urlSearch.search_url"}}> 
+9
source

If you want your property output to be wrapped in these markers, use unbound helper:

 My new car is {{unbound color}}. 

There will be no markers in your conclusions, but be careful, because the result will not be automatically updated!

 My new car is blue. 

(see http://emberjs.com/#toc_handlebars-basics )

+14
source

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


All Articles