I want to pass the value of an input field from the view to the controller. What's the best way to achieve this without binding the input field to a property of the model? Example:
view:
<form data-event-submit="searchHero">
<input type="text" placeholder="Name..." data-bind="myquery"/>
</form>
controller:
searchHero: ->
console.log myquery
Actually, this code binds the input's contents to the myquery prop of the controller, so you can access it via standard batman's get:
searchHero: ->
console.log @get 'myquery'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With