Plunker: http://plnkr.co/edit/01BRRI?p=preview
Purpose: build a directive that edits data and save back to controller scope.
Code description:
$scope.object is data in controller, I referenced it in directive by using '=' in isolate scope definition. I want to edit it in directive and save it back to controller.
Problem:
Input field would be blurred after any value change. In console you'll find the 'link' function is re-triggered after model value changed. (When model="object.meta[key][index]" in line 41).
If you comment out line 40, 42 and edit 41 to: <editable model="object.meta[key][0]"></editable>
Then everything is right (1. Link function is not re-triggered. 2. Input is not blurred after model change. 3. Controller $scope.object is updated).
I need the nested loop for my data structure, how should I do to fix this?