2

I have a usual angular model in $rootScope. Data is displayed in angular Views using {{$rootScope.client.name}}

There is a form where the user can change his name. When it's updating the form with the new name, the existing one changes in the template (which is normal because of the binding).

How can I stop this binding and make the change available on the next refresh or manually after save? Thank you!

1 Answer 1

3

Don't bind original object to a form but do a copy (angular.copy) of it before editing and bind a copy in a form. Then after "Save" copy back object bound to a form back to the original object.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.