Reputation: 1497
I have an element, which has an ng-controller, that has some values attached to scope. I have a form element inside this one, which I would like to have create its own child scope. The use case: I want the form to be populated with the parent scope's variables intially, but not have changes on the form propagate up until the user clicks the form's "submit" button.
How would I force the form to have a child scope that inherits from the parent element's scope?
Upvotes: 0
Views: 31
Reputation: 1563
Common approach in your situation is to use "new" object. You use, for example, newuser.name
as model for input and then createUser(newuser) on submit.
Here is plnkr demo: http://plnkr.co/edit/3x7T2JgV5yxb9iJqYMYq?p=preview
Upvotes: 2