This is a migrated thread and some comments may be shown as answers.

Set parent scope for Angular Kendo grid columns

2 Answers 144 Views
Grid
This is a migrated thread and some comments may be shown as answers.
CCG
Top achievements
Rank 2
CCG asked on 09 Sep 2015, 02:36 PM

I'm using the Angular directive for Kendo's grid component, but instead of using it directly, I'm having a wrapper around it to keep the dependency to a minimum.

The thing is that since I have a wrapper, after the column templates have been compiled they have the wrapper's scope as $parent instead of the outer scope.Inside the column templates I currently have to write: 

<elem attr="$parent.$parent.value"></elem>

It is rather unclear for new developers what is going on there and it is prone to errors, as well, if the hierarchy would change. Instead I would like to write:

<elem attr="value"></elem>

which means that I want to be able to define that the scope that gets created for the columns should inherit from a specific scope instead of the current scope. (Also, the wrapper has an isolated scope, so the properties are not inherited from the outer scope)

Is this possible to achieve?

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 11 Sep 2015, 01:57 PM

Hello,

 

We are not aware of any means to re-arrange the scope hierarchy in angularjs. Notice however, that the scope prototype chain mechanism should (at least in theory) allow you to access the parent properties here. 

 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
CCG
Top achievements
Rank 2
answered on 14 Sep 2015, 08:50 AM

Hi,

I see, it sounded in the docs as if you manually compiled the templates and by using transclude you can control the parent scope of the content. My scenario may be quite uncommon, but I had to ask :)

I use an isolated scope for the wrapper, so the scope is not prototypically inherited. That's why I must use $parent.

Thanks for the answer.

Regards,
JH

Tags
Grid
Asked by
CCG
Top achievements
Rank 2
Answers by
Petyo
Telerik team
CCG
Top achievements
Rank 2
Share this question
or