If you pass InterpreterContext to z.run(), it might help. for example,

* z.angularWatch("selectedNode", (before:Object, after:Object, *
*context:org.apache.zeppelin.interpreter.InterpreterContext**) => {*
*        z.run(2, context)*
*    })*

Let me know if it works.

Thanks
moon

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

> Hi Moon,
>
> Yes, you are right, I can get the updated value with z.angular(). But the
> problem is the watch I set for the value is not working correctly, i.e
> works only once in first change.
>
> Thanks,
> Hasan
>
> 18 Ağustos 2015 Salı tarihinde, moon soo Lee <m...@apache.org> yazdı:
>
> 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