How can component share the computed property data back with the controller

hi there i have a component and a controller.

All the properties live in the controller and are passed to the component like the following {{component-name property=property }}

now the component has a computed property which is based on 3-4 of its data field values. I declare that field inside the component js code. Now my controller needs to validate this value (using ember-cp-validations where the buildValidations mixin is injected into the controller).

But for some reason, even though the computedValue gets computed fine in the component, I don’t know how to send it back to the controller (when that value changes). If i simply declare it in the controller with empty value, the controller doesn’t get the value reflected back from the component - which is kinda strange because other fields (that are not computer properties) do get the values transferred back from component to controller.

I cannot inject the buildValidations mixin into the component, because the controller in question, is responsible for validating the data for other 3-4 components which are working fine (don’t have the computed property, have simple properties that are passed to the component like shown above). coz if i do that, i will get into more troublesome position, of having to call validate() method in the controller as well as one of the components - which is unnecessary complexity in my specific case.

I may be thinking to simple so I apologize. Why not send the value back in an event that the Controller subscribes too?

1 Like