I ran into this issue by updating from EmberJS 1.7 to 1.8: https://github.com/emberjs/ember.js/issues/9461#issuecomment-61369680
[Update: the example jsbins can be found in the link above. I've to earn enough reputation to be allowed to post more than two links. I am sorry for the inconvenience!]
In EmberJS it seems not to be possible to combine a component with tagName 'input' and a layout. Now I have an input element and a graphical representation sitting next to each other like:
<svg ...>
<input type="radio"...>
The image content is driven by a CSS rule which depends on the radio button state (yes, I want to style my own radio button).
My (propably very naive) components-template to achieve the rendered output:
<script type="text/x-handlebars" id="components/radio-button">
<svg><circle cx="50%" cy="50%" r="8" /></svg>
{{yield}}
</script>
[Update: Added component code]
And the component code:
App.ApplicationRoute = Ember.Route.extend({
model: function() {
return {'radio': 0};
},
});
App.RadioButtonComponent = Ember.Component.extend({
tagName: 'input',
attributeBindings: [
'type',
'checked',
'disabled',
'tabindex',
'name',
'autofocus',
'required',
'form',
'value'
],
type: 'radio',
checked: false,
disabled: false,
indeterminate: false,
init: function() {
this._super();
this.on('change', this, this._updateElementValue);
var name = this.get('name'),
controller = this.get('radioController'),
checked = controller.get('model.%@'.fmt(name)) === this.get('value');
this.set('checked', checked);
},
group: "radio_button",
classNames: ['radio-button'],
_updateElementValue: function() {
var name = this.get('name'),
controller = this.get('radioController');
controller.set('model.%@'.fmt(name), this.get('value'));
}
});
But with EmberJS 1.8 my component [Update: added code]
<script type="text/x-handlebars">
{{radio-button name="radio" radioController=this value=0}}
</script>
now gets rendered like:
<input type="radio"...><svg ...></input>
I'am now puzzled by how to keep attribute bindings for input elements and use layouts with components in EmberJS.