I have two text boxes with different ng-models. They populate using a $http.get request when a button is clicked.
Let's assume:
<input type="text" ng-model="name.title" />
<input type="text" ng-model="name.surname" />
These are successfully filled from my JSON data.
The value of name.title may sometimes be like "abc (123)". If a user edits this, I want the name.surname to become the part inside the (). If they remove "abc (123)" and simply type in 123, then 123 should reflect in name.surname.
I've experimented with various combinations using ng-blur and ng-change but haven't had any success so far.
Since it's just two textboxes, creating a new directive seems unnecessary.
How can I achieve this?
Any assistance would be greatly appreciated. :)