Ember.js View not displaying Ember.TextField {{view Ember.TextArea valueBinding=“Name” name=“Name”}}

我怕爱的太早我们不能终老 提交于 2019-12-11 20:14: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');
},

回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/21884256/ember-js-view-not-displaying-ember-textfield-view-ember-textarea-valuebinding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!