Within a dropdown, I have a selection of templates that are connected to $scope.templates:
[{"id":1, "name":"Test 1",{"id":2, "name":"Test 2"}]
.
Furthermore, there is a directive in place,
<editor data-template="1"></editor>
The goal is to re-render the directive with the appropriate template based on the selection made in the dropdown. Is this feasible? So far, my experience has only involved simple one-to-one databinding between fields and divs, without triggering a complete re-render of a directive. What would be the most effective approach for handling this scenario?
Update: Moving beyond the directive's $scope, there is also the challenge of cross-controller two-way binding. For instance, I am struggling with maintaining consistency of a service object across multiple Controllers. Ideally, changes made in one controller should be reflected in the other controller and vice versa. http://jsfiddle.net/9gSVn/1/