Attribute bindings to child elements of a component


#1

I have a custom text area component which displays remaining character count.

`

  <div class=my-textarea> 
    <textarea>
      {{content}}
   </textarea>
   {{#if isCharLimited}}
     <span> 
       {{remainingCount}} left 
   </span>
  {{/if}}
  </div>

` Since textarea supports readonly and disabled attributes I want to use attribute bindings property to bind my attributes to textarea. How can I achieve this?


#2

You should take a look at this guide, it should answer your exact question using input instead of textarea: https://guides.emberjs.com/v2.2.0/templates/binding-element-attributes/


#3

Not working. I’m ember 1.13. Strange though


#4

Can you maybe make an ember-twiddle or a JSBin that reproduces your problem? It’s hard to help solve it if I can’t reproduce it :slight_smile:


#5

Sorry. I made a silly mistake. Took a while to figure it out. A small typo in attributebindings caused the issue.


#6

Could you add a sample working code? I’ve the same problem you had.