vendredi 30 juin 2017

What to use instead of bind-attr helper in Ember.js?

When I want to use bind-attr helper on the simple table data argument (). To change the color of that column it writes an error on console:

TypeError: Cannot read property 'getAttribute' of undefined

-Here is my index.hbs:

   <table id="t01">
          <tr>
            <th>Company Name</th>
            <th>Headquarters</th> 
            <th>revenue</th>
          </tr>
          
            <tr>
                        <td>   </td>
                        <td >           </td>
                        <td>   </td>
            </tr>
          
    </table>
    <button > Change color </button>

-And here is my index.js controller:

import Ember from 'ember';


export default Ember.Controller.extend({
  className:"red",
  actions:{
    toggleColor: function(){
      if(this.get("className") == "red"){
        this.set("className","blue");  
      }else{
        this.set("className","red");  
      }
      
    }
  }
});

-Does anyone has any idea what is wrong? It doesn't even show the values in the table that would actually show if I didn't use the bind-attr.




Aucun commentaire:

Enregistrer un commentaire