I have a signup form
In the route I create the new record (with will contain the signup data)
App.SignupRoute = Ember.Route.extend({
model:function () {
return App.Fence.createRecord({date:new Date()});}});
In the form I checked successfully that the record (fence) is bound to the form elements
Now I would like to have a save button and access the data in the controller method
I tried:
< a href="#" {{ action "addsignup" this}}>SignUp</a>
and
< button type="button" {{action "addsignup" this}}>SignUp</button>
The controller method is being called, but I cannot access the fence instance 🙁
App.SignupController = Ember.ObjectController.extend({
addsignup:function (fence) {
console.log(fence.name); // => undefined
console.log(this.name); // => undefined
console.log(fence.get("name")); // => undefined
console.log(this.get("name")); // => undefined
How can I access the model data in the controller method?
Thank you very much for any help!
by default, an action passes the view. With
you can then access the controller and thus its members with
By passing an object in action, you can access it when definition corresponding parameters in the function definition.
hope this helps, ph