Reputation: 15036
I have a simple component that looks like this:
<script type="text/x-handlebars" id="components/Gd-text-input">
<label {{bind-attr for="name"}}>
{{label}}
</label>
<input type="text" {{bind-attr name="key" id="name"}} />
</script>
I would like to add the attribute type to the input field, and if no type is passed when including the component, like this for example:
{{Gd-text-input label="First Name" name="firstname" key="entry.810220554" }}
I would like it to default to type="text". How would I go about doing this?
Upvotes: 4
Views: 1383
Reputation: 10562
Yep, you can subclass Ember.Component
:
YourApp.GdTextInputComponent = Ember.Component.extend({
type: 'text'
});
Upvotes: 6