Hi Hasan,

You might able to get updated value in scala side, by doing

z.angular("selectedNode")

Thanks,
moon

On Tue, Aug 18, 2015 at 6:02 AM hasan türken <turk...@gmail.com> wrote:

> Hi,
>
> First of thanks for the awesome Angular interpreter, which seems to have a
> big potential.
> I am trying to detect a change on an Angular variable using the Angular
> interpreter. I am changing the Angular variable within a javascript
> function, see the result but binded scala object does not change.
>
> I am binding with:
>
> *var selectedNode = "none"*
> *def plotter = {*
> *    ...*
>
> *    z.angularBind("selectedNode", selectedNode)*
> *    z.angularUnwatch("selectedNode")*
> *    z.angularWatch("selectedNode", (before:Object, after:Object) => {*
> *        z.run(2)*
> *    })*
> *    ...*
> *}*
>
> Then:
>
> *    %angular*
>     *<div id="tree_1">*
> *    <h2>Selected Node: {{selectedNode}}</h2>*
> *    </div>*
>
> I can see "Selected Node: none"
>
> I have a node and I set a dblclick function on it:
>
> *    function dblclick(d) {*
> *    var scope = angular.element($("#tree_1")).scope();*
> *    scope.$apply(function(){*
> *        scope.selectedNode = d.name <http://d.name>;*
> *        console.log(d.name <http://d.name>);*
> *    })*
>
> When I double click a node, it successfully sets the selectedNode
> variable, since I can see the name as:
>
> Selected Node: some-node-name
>
> But the problem is, it is not reflected to scala side, i.e. when I run:
>
>    * println(selectedNode)*
>
> I can not get the updated name also can not detect any change even I set
> with angularWatch.
>
> Thanks in advance,
> Hasan
>
>
>
>

Reply via email to