Re: Problem with angular scope

2016-03-22 Thread Corneau Damien
There has been some changes and refactoring of the angular display system,
however I don't think we really loose anything in term of functionality.

Currently its breaking a few notebooks accessing the scope with javascript.
Since there was no official/proper way to access the scope variables using
javascript, there is a lot of different usage.

In the PR mentioned in this thread, we were also talking about trying to
have a proper way to get the scope in javascript in the future, instead of
having people using different methods.
On Mar 22, 2016 7:15 PM, "tog"  wrote:

> Hi Damien
>
> I am not so familiar with the terms you mentioned (app vs paragraph),
> so does that mean that we loose in term of functionality from 0.5.6 and
> dev?
> What is the plan to share variables between spark and angular ?
>
> Thanks
> Guillaume
>
> On Tue, 22 Mar 2016 at 06:51 Corneau Damien  wrote:
>
>> Yes, it was merged, you can see the discussion in that PR.
>> The compatibility was only restored for paragraph so that it allow this
>> method to work:
>> https://gist.github.com/granturing/a09aed4a302a7367be92
>>
>> Access from app level wasn't restored
>>
>> On Tue, Mar 22, 2016 at 2:40 PM, Balachandar R.A. <
>> balachandar...@gmail.com> wrote:
>>
>>> Hi
>>>
>>> I see this issue was discussed in
>>> https://github.com/apache/incubator-zeppelin/pull/720 and looks like
>>> for providing backward compatibility, the compiledScope is made available.
>>> I checked the master version and I see the below lines in
>>> https://github.com/apache/incubator-zeppelin/blob/master/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
>>>
>>> $scope.paragraph = null;
>>> $scope.originalText = '';
>>> $scope.editor = null;
>>> var paragraphScope = $rootScope.$new(true, $rootScope);
>>> // to keep backward compatibility
>>> $scope.compiledScope = paragraphScope
>>>
>>>
>>>
>>> I thought the commit for backward compatibiity is merged with the master
>>> and it should work if we use master now. No?
>>>
>>> regards
>>> Bala
>>>
>>> On 21 March 2016 at 19:49, Corneau Damien  wrote:
>>>
 Hi,
 If you use master, this won't work.
 The scope storage was changed, and it is now kept in the paragraph
 controller only. (Scope can be applied to notebook or specific paragraphs
 from backend)

 One way to deal with this would be to have a div with an id in your
 paragraph 2, then access that dom element parent scope (which would be the
 paragraph scope)
 On Mar 21, 2016 5:58 PM, "Balachandar R.A." 
 wrote:

> Hello
>
> This is my para 1
>
>
> var name = "bala"
> z.angularBind("name",name)
>
> This is my para2
>
> %angular
> 
> var controllerElement = document.querySelector('[ng-app]');
> var scope =
> angular.element(controllerElement).scope().compiledScope;
> console.log(scope.name);
> 
>
>
> I ran para 1 and then para 2. Expected to see "bala" as output but
> this did not print anything. what could be the issue here? I do not see 
> any
> error log as well in my browser console.
>
> regards
> Bala
>

>>>
>>


Re: Problem with angular scope

2016-03-22 Thread tog
Hi Damien

I am not so familiar with the terms you mentioned (app vs paragraph),
so does that mean that we loose in term of functionality from 0.5.6 and dev?
What is the plan to share variables between spark and angular ?

Thanks
Guillaume

On Tue, 22 Mar 2016 at 06:51 Corneau Damien  wrote:

> Yes, it was merged, you can see the discussion in that PR.
> The compatibility was only restored for paragraph so that it allow this
> method to work:
> https://gist.github.com/granturing/a09aed4a302a7367be92
>
> Access from app level wasn't restored
>
> On Tue, Mar 22, 2016 at 2:40 PM, Balachandar R.A. <
> balachandar...@gmail.com> wrote:
>
>> Hi
>>
>> I see this issue was discussed in
>> https://github.com/apache/incubator-zeppelin/pull/720 and looks like for
>> providing backward compatibility, the compiledScope is made available. I
>> checked the master version and I see the below lines in
>> https://github.com/apache/incubator-zeppelin/blob/master/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
>>
>> $scope.paragraph = null;
>> $scope.originalText = '';
>> $scope.editor = null;
>> var paragraphScope = $rootScope.$new(true, $rootScope);
>> // to keep backward compatibility
>> $scope.compiledScope = paragraphScope
>>
>>
>>
>> I thought the commit for backward compatibiity is merged with the master
>> and it should work if we use master now. No?
>>
>> regards
>> Bala
>>
>> On 21 March 2016 at 19:49, Corneau Damien  wrote:
>>
>>> Hi,
>>> If you use master, this won't work.
>>> The scope storage was changed, and it is now kept in the paragraph
>>> controller only. (Scope can be applied to notebook or specific paragraphs
>>> from backend)
>>>
>>> One way to deal with this would be to have a div with an id in your
>>> paragraph 2, then access that dom element parent scope (which would be the
>>> paragraph scope)
>>> On Mar 21, 2016 5:58 PM, "Balachandar R.A." 
>>> wrote:
>>>
 Hello

 This is my para 1


 var name = "bala"
 z.angularBind("name",name)

 This is my para2

 %angular
 
 var controllerElement = document.querySelector('[ng-app]');
 var scope =
 angular.element(controllerElement).scope().compiledScope;
 console.log(scope.name);
 


 I ran para 1 and then para 2. Expected to see "bala" as output but this
 did not print anything. what could be the issue here? I do not see any
 error log as well in my browser console.

 regards
 Bala

>>>
>>
>


Re: Problem with angular scope

2016-03-21 Thread Corneau Damien
Hi,
If you use master, this won't work.
The scope storage was changed, and it is now kept in the paragraph
controller only. (Scope can be applied to notebook or specific paragraphs
from backend)

One way to deal with this would be to have a div with an id in your
paragraph 2, then access that dom element parent scope (which would be the
paragraph scope)
On Mar 21, 2016 5:58 PM, "Balachandar R.A." 
wrote:

> Hello
>
> This is my para 1
>
>
> var name = "bala"
> z.angularBind("name",name)
>
> This is my para2
>
> %angular
> 
> var controllerElement = document.querySelector('[ng-app]');
> var scope = angular.element(controllerElement).scope().compiledScope;
> console.log(scope.name);
> 
>
>
> I ran para 1 and then para 2. Expected to see "bala" as output but this
> did not print anything. what could be the issue here? I do not see any
> error log as well in my browser console.
>
> regards
> Bala
>