Lets assume i have a form template with all business like method calling, validating, etc. I want reuse this component in different places in application. So my question is simple: how to inform parent template about state of child (my form template), e.g. after form data submitting. Till now i have found some ideas:
Use Session - don’t like this way but simplest
Trigger some custom event which can be caught in parent like any other events like click, etc. - how???
Directly change some dict in parent (using “closest” monkey patch) - feasible but…
Render in child template button: “Close form”, and catch this click event in parent - use this method for now
Wow. It look really great. Like sth that, i in my opinion, is the major lack in meteor. But… im not happy with flow direction in your example “Calling a parent function from the child”. Why not listen (in parent) for state change in child and react for that? Can it be done with viewmodel?
I included an autorun that “listens” for changes in the children but I rarely have to do something like that because all values and functions are reactive in ViewModel.