Ember.js View not displaying Ember.TextField {{vie

2019-09-01 08:19发布

I want to show this input so I may edit a category's 'Name', but the view is not displaying.

The result is only the Names for each Category appearing on the list. Each category should have it's own input with a value set to the 'Name' for that Category.

I am not receiving any errors, so what am I doing incorrectly?

  {{#each}}
   <tr>
     <td>
      {{view Ember.TextField valueBinding="Name" name="Name"}}
      <label class="category-text">
        {{#linkTo 'category' this}}
          {{Name}}
        {{/linkTo}}
      </label>
     </td>
  </tr>
{{/each}}

EDIT:

I've been playing around with implementing different input methods and none of them are showing up on the list of Categories! Waaah?

Here's what I tried:

<input type="text" Value="Name">

,

{{input type="text" valueBinding="Name" name="Name"}}

EDIT2:

VpcYeoman.CategoriesRoute = Ember.Route.extend({
    model: function() {
        VpcYeoman.Category.FIXTURES=[];
        $.ajax({
            url: '/categories',
            dataType: 'json',
            type:"get",      
            async: false,
            success : function(data) {      
                VpcYeoman.Category.FIXTURES=data;
            }
        });
        return this.store.find('category');
    }
}); 

and

model: function() {
  return this.store.find('category');
},

2条回答
Fickle 薄情
2楼-- · 2019-09-01 08:44

Here's a working JSBin for what you're trying to do. I'm not sure at which point you're having trouble, but you should try to match your system to be something like this.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-09-01 08:59

Don't think using Ember.TextField directly is recommended anymore, you should use {{input value=name}} instead. More documentation on the input helper here.

查看更多
登录 后发表回答