mardi 3 novembre 2015

How use {{#each}} in ember2.0

Iam new to ember .I want to create a dropdown for the countries name using ember .I have tried the below code but it does not work

App.SignupRoute = Ember.Route.extend({
model: function () {
    countries: { };
    var self = this;
    $.ajax({
        url: "View/countries.json",
        type: "GET",
        async: false,
        success: function (data) {
            self.set("countries",JSON.parse(data));
        }
    });
 }
});

  <select>
     {{#each model as |countries|}}
          <option value={{countries.code}}>{{countries.name}}</option>           
     {{/each}}
  </select>

Help me to resolve this




Aucun commentaire:

Enregistrer un commentaire