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

What is the proper way to access a window from and Angular Controller

5 Answers 146 Views
Window
This is a migrated thread and some comments may be shown as answers.
Kelly
Top achievements
Rank 1
Kelly asked on 15 Oct 2014, 08:55 PM
I have a window that I'd like to toggle open and closed from a controller but since kendo creates it's windows outside of the body tag I cannot reference it using $scope.myWindow. What is the best way to access this window from a controller?

5 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 16 Oct 2014, 08:46 AM
Hello Kelly,

See this Dojo snippet for a demo of referencing the window from a scope method.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Kelly
Top achievements
Rank 1
answered on 16 Oct 2014, 12:27 PM
Does this work when you include a window with ng-include or if you are trying to call a window from an included html snippet?

Examples:

1.
<ng-controller>

<open window command />
<ng-include "window" />

</ng-controller>


2.
<ng-controller>

<ng-include "window open inside this code" />
<window />

</ng-controller>








0
Alex Gyoshev
Telerik team
answered on 17 Oct 2014, 07:36 AM
Hello Kelly,

A more appropriate way to achieve this would be to have a hollow window around the ng-include. This way the open button will not trust blindly that the include includes the window, and the include will contain only the inner logic. Placing the window in an ng-include might register it in a child scope, thus it will be unavailable to outside widgets.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
asd
Top achievements
Rank 1
answered on 11 Nov 2014, 10:46 AM
Is there a possibility to make it work using ng-include? Iam asking because I would like to have 2 views:
First with grid and data
Second with kendo window that opens whenever I add/edit grid row.
In second view I want to define what fields are present in window and whats the width and heght of that window. ( using k-content: {url: ...} is not a option for my case )
0
Alex Gyoshev
Telerik team
answered on 12 Nov 2014, 09:11 AM
No, using a ng-include creates another scope, so the window is not usable in the controller. Use one of the solutions outlined in the thread.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Window
Asked by
Kelly
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Kelly
Top achievements
Rank 1
asd
Top achievements
Rank 1
Share this question
or