Within my Angular 6 application, I have a method designed to alter a property of my component. The scenario is as follows:
...
value: number = 10;
changeValue(v) { return v = 100; }
...
Upon invoking this method with the component's property:
this.changeValue(this.value); // the value remains unchanged
I anticipate that this.value
should now be 100, but it stubbornly remains at 10. While I am able to access the value of the v
parameter (which corresponds to this.value
in this case), any attempts to modify it within the function are unsuccessful.
Where exactly am I going wrong and how can I achieve the desired functionality? Would you kindly provide guidance on addressing this issue? Any assistance would be greatly appreciated.