Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4830

Observer in component not triggered by injected property change

$
0
0

@Soulou wrote:

Hi there,

I've a problem building a trigger, reset relationship between two components.

  • Parent trigger action by toggling property, child component detect the change and send an action back to the parent which reset its state.

http://emberjs.jsbin.com/yowefawaze/1/edit?html,js,console,output

The output is the following:

"DEBUG: parent trigger"
"DEBUG: parent: observer triggered"
"DEBUG: parent set true"
"DEBUG: child: observer triggered true"
"DEBUG: parent reset"
"DEBUG: parent: observer triggered"
"DEBUG: parent set false"

I thought observer were synchronous, and that the results would be "set, parent obs, child obs, ember.debug", but it's not, the child obs is called after the trigger method

"DEBUG: parent trigger"
"DEBUG: parent: observer triggered"
"DEBUG: child: observer triggered true"
"DEBUG: parent set true"

And over that, child obs is never called after reset, which result the child property stays 'true' and won't trigger reset anymore.

Can you give me a hint on what's wrong with this design?

Thanks a lot,

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4830

Trending Articles