Value passed in component input changing parent

Viewed 1860

As I understand it, the Input fields in a component are supposed to be one directional (parent to child). However, I have a value I'm passing into an Input and then modifying it in the component, but I'm noticing it changes in the parent as well. That makes some sense to me, as objects are passed by reference, but I'm guessing that means that the whole "one way binding" thing Angular sets is just a paradigm, not strict? Angular does nothing under the hood to enforce one way binding?

Basically, I'm doing:

<session-form [values]="session"></session-form>

In the session-form component, I change session.start from a unixtimestamp to a Moment object. But I then notice in the parent, session.start is also a Moment object.

Is there a paradigm for using data like this? Should I be copying input values to a variable scoped strictly to the component once it's set?

2 Answers
Related