0

I am trying to get changes from one grid to flow into another, and subsequently update one of the rows in that underlying datasource. In the attached plunker, I basically want the underlying datasource of Bar to have the TotalSalary row updated with the total salary that is calculated from Foo. The total salary gets passed down upon hitting enter in the textbox.

I have gotten it working by emitting Foo.getSalaryTotal() instead of Foo itself; however, I would prefer to pass through Foo because I can foresee myself wanting multiple fields passed through and not wanting to have tons of inputs/ouputs.

http://plnkr.co/edit/4sw4yhzDTep4j0jGLDhD?p=preview

Mark Rajcok
  • 362,217
  • 114
  • 495
  • 492
Rob Snider
  • 33
  • 5
  • you could try creating a centralized service that handles the data or you can have the directives(if the components are directives) pass eachother their own controllers and $watch their variables. – Yeysides Nov 20 '15 at 19:44

1 Answers1

0

I recently answered almost the same question here.

Since foosGrid is being (re)set to the same foos object in foosChanged(), Angular will not notice the change because foosGrid is still referencing the same object.

One option is to implement ngDoCheck() in your Bar component and perform a custom check to see if the properties of the foos object in Bar have changed.

Community
  • 1
  • 1
Mark Rajcok
  • 362,217
  • 114
  • 495
  • 492