Picture this scenario where a custom directive is referenced in myHtml.tpl.html
:
<my-directive></my-directive>
This directive starts with an isolated scope.
Naturally, there's a controller tied to myHtml.tpl.html
.
I aim to pass a computed array from the isolated scope to the controller's scope.
One approach could be:
<my-directive arrayToCompute="arrayToCompute"></my-directive>
The isolated scope (in the directive) would look like this:
scope: {arrayToCompute: "="}
and the controller would begin with an empty array declaration:
$scope.arrayToCompute = [];
However, this solution might not seem very elegant...
Is there a better option?
(Note that I want to retain the scope isolation of the directive).