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

Re : Property name event not firing on computed value

$
0
0
Thanks for the reply Maxisme. I know about compute.bind however and that's not what I'm looking for. When you set a function as the value on Map with attr it automatically turns it into a compute.

As I understand it, essentially this...

  1. state.attr('baz', function () {
  2.     return this.attr('foo') + ", " + this.attr('bar');
  3. });

...is the same as this...

  1. state.attr('baz', can.compute(function () {
  2.     return this.attr('foo') + ", " + this.attr('bar');
  3. }));

So, my question is, on these computed values, how can I listen for when they change? I've tried the code I posted above and I've also tried doing something along these lines...

  1. state.attr('baz').bind('change', handler);

...but neither of these approaches seem to work... also, even if the latter approach did work, I don't want to do that ... I want to use can.Map's templated event binding as in my first example.

Any other thoughts on this?

Thanks again for the help.

-Mac

Viewing all articles
Browse latest Browse all 3491

Trending Articles