samedi 18 avril 2015

form submit action error emberjs

I'm trying to create a submit action on a register form. here is my register handlebar:



<form class="form-signin" {{action "register" on="submit"}}>
{{input class="form-control" value=username type="text" placeholder="Username"}}
{{input class="form-control" value=password type="password" placeholder="Password" }}
<button class="btn btn-lg btn-primary btn-block" type="submit">Register</button>
</form>


here is the router:



import Ember from 'ember';
import config from './config/environment';

var Router = Ember.Router.extend({
location: config.locationType
});

Router.map(function() {
this.resource('register', {path: '/register'});
});

export default Router;


and here is my register controller:



import Ember from 'ember';

export default Ember.Controller.extend({
register: function(){
console.log('hey');
return 'hello';
}
});


when I submit the form I get this error:



Uncaught Error: Nothing handled the action 'register'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.


what am I doing wrong?





Aucun commentaire:

Enregistrer un commentaire