Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

can.Control input change - newValue, oldValue

$
0
0
Hi folks,
I'm new in CanJS, hope this question will not be stupid )

So the question is:
      If I bind change event to can.Map object I can see newVal and oldVal like this:
  1. var o = new can.Map({});
  2. o.bind('change', function(ev, attr, how, newVal, oldVal) {
  3.     console.log('Something on o changed.');
  4. });
      but I can't see them if I listen change event inside can.Control like this:
  1. var addToCartController = can.Control({},{
  2.     init: function(element, options) {
  3.       // code
  4.     },
  5.     "input change": function(element, event, newValue, oldValue) {
  6.         console.log(newValue); //--> undefined
  7.         console.log(oldValue); //--> undefined
  8.     }
  9. });

Is this ok? And which is the best way to get oldVal and newVal? 

Thanks in advance,
Andrei

Viewing all articles
Browse latest Browse all 3491

Trending Articles