mardi 18 août 2015

Does Ember 2.0 automatically connect handlebar template files to controllers?

I'm creating a very basic Ember application using ember-cli and Ember 2.0. I used ember-cli to generate a template called 'footer.hbs' and the same component named 'footer.js'. Should Ember be able to correctly pick up any expressions I use in the footer.hbs? For example, I'm using the following three files: footer.js, footer.hbs, and application.hbs which imports the partial 'footer'. Why does the {{firstName}} property not show at all?

footer.js - /app/controllers/footer.js import Ember from 'ember';

export default Ember.Controller.extend({
  firstName: "TEST" 
});

footer.hbs - /app/template/footer.hbs

<footer class='nav navbar-inverse navbar-fixed-bottom'>
  <div class='container'>
      <ul class="footer-social list-inline">
        <li></li>
        <li></li>
        <li>{{firstName}}</li>
      </ul>
  </div>
</footer>

application.hbs

{{partial 'navigation'}}
{{outlet}}
{{partial 'footer'}}




Aucun commentaire:

Enregistrer un commentaire