1
votes

I've started learning Emberjs and i'have an error but have not found the problem :

In my view named new.hbs have this :

{{input value=name type="text" placeholder="Event name" size="50"}}
<button type="submit" {{action "create"}}>Done</button>

In my model event.js have this :

Kiksoo.Event = DS.Model.extend({
  name:    DS.attr( 'string' ),
});

And in eventController.js have this :

App.EventsNewController = Ember.ObjectController.extend({
  actions: {
    create: function(){

      alert(this.get('model'));


      var newEvent = this.store.createRecord('event', this.get('model'));
      newEvent.save();


    }
  }
});

But have the error :

Uncaught Error: Assertion Failed: Cannot delegate set('name', s) to the 'content' property of object proxy : its 'content' is undefined.

Thank's

1

1 Answers

0
votes

Try this approach for your EventsNewController:

App.EventsNewController = Ember.ObjectController.extend({
  actions: {
    create: function(){

      var name = this.get('name');
      alert(name);

      var newEvent = this.store.createRecord('event', {
          name: name
      });
      newEvent.save();
    }
  }

});

see: http://jsbin.com/zigolifekopi/1/edit