dimanche 2 août 2015

Have a form to create new item on the listing page with ember-forms

My question can seems very basic but I can resolve my problem.

I want to show a list of skill and allow to add a new one at the bottom.

To do that, I have this template :

{{#each model as |skill|}}
  <div class="skill">
    {{skill}}
  </div>
{{/each}}

{{#em-form model=newSkill}}
  {{em-input property="description" label="Description"
    placeholder="Description" class="description"}}
{{/em-form}}

This route :

export default Ember.Route.extend
  model: (params) ->
    @modelFor('user').get('searched_skills')

And this controller :

export default Ember.Controller.extend
  newSkill: (->
    @store.createRecord('skill')
  ).property('newSkill')
  actions:
    submit: ->
      console.log @newSkill.get('description')

With this code, I have this error Object.defineProperty called on non-object.

How can I have a form on the page of the list?




Aucun commentaire:

Enregistrer un commentaire