i have component has text field, this
<div> {{input type='text' insert-newline='postmessage' class="form-control" autofocus="true"}} <input type="hidden" name="uid" value={{room.uid}}/> </div>
the component have snippet, lives inside route called room
export default ember.route.extend({ model(params){ this.store.findrecord('room', params.uid); } });
to handle action in input
, created controller room: app/controllers/room.js
import ember 'ember'; export default ember.controller.extend({ actions: { postmessage(params){ console.log(params); } } });
but when hit enter, error:
uncaught error: <chathub-ember@component:chat-room::ember1071> had no action handler for: postmessage
i tried put action in route , didn't worked
in room.hbs file,
{{my-component myaction='postmessage'}}
and in my-component.js
import ember 'ember'; export default ember.component.extend({ actions: { postmessage(params) { this.sendaction('myaction', params); } } })
Comments
Post a Comment