I have a form like this in a template:
<form {{action 'add' on='submit'}}>
<label for="name">Name</label>
{{input value=name placeholder='Enter name' required="required"}}
</form>
Then I have the following route:
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
add: function() {
alert(this.get('name'));
}
}
});
The alert is fired, but the output is "undefined". I tried to create a model in the route, but it didn't help. What am I missing to get the alert to show the string I type in the form? I don't want to use a controller, since controllers are discouraged.
Aucun commentaire:
Enregistrer un commentaire