lundi 31 août 2015

Ember.js: how to pass model to a template

I'm testing Ember.js and I have a very trivial problem. I want to show in Handlebars Template an input text with the value of a variable called 'test' with value 'This is a test'

The problem is that input is empty as well as h1 element although the varibale has a value

This is file routes/index.js

export default Ember.Route.extend({

    model : function(){
        return { test:'This is a test'}
    },

    /* Default Implementation */
    setupController: function(controller, model) {
        controller.set('model', model);
    }

});

This is file templates/index.hbs

{{input value=test type="text" }}

<h1>  {{test}} </h1>

This is file router.js

Router.map(function() {

this.route('index', { path: '/' });

});

Where is the error? Thanks in advance




Aucun commentaire:

Enregistrer un commentaire