javascript - Ember.js: How to observe when a value in an input field changes -
i need create simple html input text field in ember.js app. value particular input box not bound specific model. when input text box blurs or loses focus, need able run javascript. in template, have far:
{{input valuebinding="pitchersalary" placeholder=0}}
i tried observing value of pitchersalary
doing following in controller without luck:
myapp.optimalcontroller = ember.objectcontroller.extend({ pitchersalaryobserver: function () { var self = this; console.log("changing...."); }.observes('pitchersalary'), });
what's correct way of doing this?
you isn't backed model, yet controller saying it's backed model. it's you're confusing ember, wants save model, should backing controller, finds no model. objectcontroller proxies properties to/from controller model, , when has no model, yells misuse.
bad: objectcontroller without model
http://emberjs.jsbin.com/niyawido/3/edit
good: objectcontroller model
http://emberjs.jsbin.com/niyawido/4/edit
Comments
Post a Comment