How to set property without triggering a change event for avoiding stack overflow?

9 views
Skip to first unread message

Rodrigo Rosenfeld Rosas

unread,
Jun 27, 2012, 8:39:32 AM6/27/12
to seren...@googlegroups.com
I have registered a callback for a 'change' event, and in this callback I need to set some validation ad eventually change some properties but that would lead to a stack overflow:

@bind 'change', -> @set 'valid', @isValid() # just a small example, I do lots of stuff here.

isValid:
  validate()
  @get('prop')

validate:
  @set('prop') @get('prop')?.trim() # or @attributes.prop = @get('prop').trim(), doesn't matter

How can I change an attribute preventing the 'change' event to trigger?

Rodrigo Rosenfeld Rosas

unread,
Jun 27, 2012, 8:49:30 AM6/27/12
to seren...@googlegroups.com
Em quarta-feira, 27 de junho de 2012 09h39min32s UTC-3, Rodrigo Rosenfeld Rosas escreveu:
... 
validate:
  @set('prop') @get('prop')?.trim() # or @attributes.prop = @get('prop').trim(), doesn't matter

Sorry about that. "@attributes.prop = " does the trick. It was another one that was bitting me...
Reply all
Reply to author
Forward
0 new messages