Hello everyone,
I’m relatively new to ember and have a question regarding building components. I am trying to build a library to quickly create inputs using ember components. I am aware libraries like this exist already but I figured I’d build it as a means of acquiring ember experience.
Currently my interface looks something like this,
#sometemplate.hbs
{{quick-input input-model=model attribute="name"}}
and my component looks something like this
#quick-input.js
export default Ember.Component.extend({
value: function() {
return this.get('input-model')[this.get('attribute')]
}.property('input-model.name')
})
#quick-input.hbs
<label>{{attribute}}</label>
<input value={{value}}>
Is there any way to reference the model without explicitly passing it into the component?
My ideal component API would be something like this,
#sometemplate.hbs
{{quick-input attribute="name"}}
Sorry if this is a dumb question or one that is answered explicitly in the docs somewhere, I couldn’t find anything.
Thanks!